Commits

Audrius Kažukauskas  committed a3f0157

Upgrade to JSLint 2012-11-17.

  • Participants
  • Parent commits 8d25e56

Comments (0)

Files changed (1)

File plugin/jslint/jslint.js

 // jslint.js
-// 2012-09-19
+// 2012-11-17
 
 // Copyright (c) 2002 Douglas Crockford  (www.JSLint.com)
 
 //     anon       true, if the space may be omitted in anonymous function declarations
 //     bitwise    true, if bitwise operators should be allowed
 //     browser    true, if the standard browser globals should be predefined
-//     cap        true, if upper case HTML should be allowed
 //     'continue' true, if the continuation statement should be tolerated
 //     css        true, if CSS workarounds should be tolerated
 //     debug      true, if debugger statements should be allowed
     'border-top', 'border-top-color', 'border-top-left-radius',
     'border-top-right-radius', 'border-top-style', 'border-top-width',
     'border-width', bottom, 'box-shadow', br, braille, browser, button, c, call,
-    canvas, cap, caption, 'caption-side', center, charAt, charCodeAt, character,
+    canvas, caption, 'caption-side', center, charAt, charCodeAt, character,
     cite, clear, clip, closure, cm, code, col, colgroup, color, combine_var,
     command, conditional_assignment, confusing_a, confusing_regexp,
     constructor_name_a, content, continue, control_a, 'counter-increment',
     expected_percent_a, expected_positive_a, expected_pseudo_a,
     expected_selector_a, expected_small_a, expected_space_a_b, expected_string_a,
     expected_style_attribute, expected_style_pattern, expected_tagname_a,
-    expected_type_a, f, fieldset, figure, filter, first, flag, float, floor,
-    font, 'font-family', 'font-size', 'font-size-adjust', 'font-stretch',
+    expected_type_a, f, fieldset, figcaption, figure, filter, first, flag, float,
+    floor, font, 'font-family', 'font-size', 'font-size-adjust', 'font-stretch',
     'font-style', 'font-variant', 'font-weight', footer, forEach, for_if, forin,
     form, fragment, frame, frameset, from, fromCharCode, fud, funct, function,
     function_block, function_eval, function_loop, function_statement,
             anon      : true,
             bitwise   : true,
             browser   : true,
-            cap       : true,
             'continue': true,
             css       : true,
             debug     : true,
             em:       {},
             embed:    {},
             fieldset: {},
+            figcaption: {parent: ' figure '},
             figure:   {},
             font:     {},
             footer:   {},
             the_token.thru = character;
             id = the_token.id;
             prereg = id && (
-                ('(,=:[!&|?{};'.indexOf(id.charAt(id.length - 1)) >= 0) ||
+                ('(,=:[!&|?{};~+-*%^<>'.indexOf(id.charAt(id.length - 1)) >= 0) ||
                 id === 'return' || id === 'case'
             );
             return the_token;
                         if (i === 0) {
                             break;
                         } else if (i > 0) {
-                            character += 1;
+                            character += i;
                             source_row = source_row.slice(i);
                             break;
                         } else {
             case 'prefix':
             case 'suffix':
             case undefined:
-                return a.id === b.id && are_similar(a.first, b.first);
+                return a.id === b.id && are_similar(a.first, b.first) &&
+                    a.id !== '{' && a.id !== '[';
             case 'infix':
                 return are_similar(a.first, b.first) &&
                     are_similar(a.second, b.second);
         if (typeof left === 'object') {
             if (left.string === 'parseInt' && p.length === 1) {
                 warn('radix', left);
+            } else if (left.string === 'String' && p.length >= 1 && p[0].id === '(string)') {
+                warn('unexpected_a', left);
             }
             if (!option.evil) {
                 if (left.string === 'eval' || left.string === 'Function' ||
                     left.id !== '?') {
                 warn('bad_invocation', left);
             }
-            if (left.id === '.' && p.length > 0 &&
-                    left.first && left.first.first &&
-                    are_similar(p[0], left.first.first)) {
-                if (left.second.string === 'call' ||
-                        (left.second.string === 'apply' && (p.length === 1 ||
-                        (p[1].arity === 'prefix' && p[1].id === '[')))) {
-                    warn('unexpected_a', left.second);
+            if (left.id === '.') {
+                if (p.length > 0 &&
+                        left.first && left.first.first &&
+                        are_similar(p[0], left.first.first)) {
+                    if (left.second.string === 'call' ||
+                            (left.second.string === 'apply' && (p.length === 1 ||
+                            (p[1].arity === 'prefix' && p[1].id === '[')))) {
+                        warn('unexpected_a', left.second);
+                    }
+                }
+                if (left.second.string === 'toString') {
+                    if (left.first.id === '(string)' || left.first.id === '(number)') {
+                        warn('unexpected_a', left.second);
+                    }
                 }
             }
         }
             if (next_token.id === '/' || next_token.id === '(regexp)') {
                 warn('wrap_regexp');
             }
-            this.first = expression(20);
+            this.first = expression(0);
+            if (this.first.assign) {
+                warn('unexpected_a', this.first);
+            }
         }
         if (peek(0).id === '}' && peek(1).id === 'else') {
             warn('unexpected_else', this);
 
     function style_selector() {
         if (next_token.identifier) {
-            if (!Object.prototype.hasOwnProperty.call(html_tag, option.cap
-                    ? next_token.string.toLowerCase()
-                    : next_token.string)) {
+            if (!Object.prototype.hasOwnProperty.call(html_tag,
+                    next_token.string)) {
                 warn('expected_tagname_a');
             }
             advance();
         }
     }
 
-    function do_tag(name, attribute) {
-        var i, tag = html_tag[name], script, x;
+    function do_tag(tag, name, attribute) {
+        var i, script, x;
         src = false;
-        if (!tag) {
-            stop(
-                bundle.unrecognized_tag_a,
-                next_token,
-                name === name.toLowerCase()
-                    ? name
-                    : name + ' (capitalization error)'
-            );
-        }
         if (stack.length > 0) {
             if (name === 'html') {
                 stop('unexpected_a', token, name);
                 if (x.indexOf(' ' + stack[stack.length - 1].name + ' ') < 0) {
                     stop('tag_a_in_b', token, name, x);
                 }
-            } else if (!option.adsafe && !option.fragment) {
+            } else if (x !== false && !option.adsafe && !option.fragment) {
                 i = stack.length;
                 do {
                     if (i <= 0) {
 
     function html() {
         var attribute, attributes, is_empty, name, old_white = option.white,
-            quote, tag_name, tag, wmode;
+            quote, tag_name, tag, value, wmode;
         xmode = 'html';
         xquote = '';
         stack = null;
                 tag_name = next_token;
                 name = tag_name.string;
                 advance_identifier(name);
-                if (option.cap) {
-                    name = name.toLowerCase();
-                }
                 tag_name.name = name;
                 if (!stack) {
                     stack = [];
                 }
                 tag = html_tag[name];
                 if (typeof tag !== 'object') {
-                    stop('unrecognized_tag_a', tag_name, name);
+                    tag = {parent: false};
+                    warn('unrecognized_tag_a', tag_name, name === name.toLowerCase()
+                        ? name
+                        : name + ' (capitalization error)');
+                } else {
+                    is_empty = tag.empty;
                 }
-                is_empty = tag.empty;
                 tag_name.type = name;
                 for (;;) {
                     if (next_token.id === '/') {
                     attribute = next_token.string;
                     option.white = old_white;
                     advance();
-                    if (!option.cap && attribute !== attribute.toLowerCase()) {
+                    if (attribute !== attribute.toLowerCase()) {
                         warn('attribute_case_a', token);
                     }
                     attribute = attribute.toLowerCase();
                         xmode = 'html';
                         xquote = '';
                         advance(quote);
-                        tag = false;
+                        value = false;
                     } else if (attribute === 'style') {
                         xmode = 'scriptstring';
                         advance('=');
                         xmode = 'html';
                         xquote = '';
                         advance(quote);
-                        tag = false;
+                        value = false;
                     } else {
                         if (next_token.id === '=') {
                             advance('=');
-                            tag = next_token.string;
+                            value = next_token.string;
                             if (!next_token.identifier &&
                                     next_token.id !== '"' &&
                                     next_token.id !== '\'' &&
                             }
                             advance();
                         } else {
-                            tag = true;
+                            value = true;
                         }
                     }
-                    attributes[attribute] = tag;
-                    do_attribute(attribute, tag);
+                    attributes[attribute] = value;
+                    do_attribute(attribute, value);
                 }
-                do_tag(name, attributes);
+                do_tag(tag, name, attributes);
                 if (!is_empty) {
                     stack.push(tag_name);
                 }
                     warn('bad_name_a');
                 }
                 name = next_token.string;
-                if (option.cap) {
-                    name = name.toLowerCase();
-                }
                 advance();
                 if (!stack) {
                     stop('unexpected_a', next_token, closetag(name));
             key,
             keys = Object.keys(property).sort(),
             length,
-            output = ['/*properties'],
             mem = '    ',
             name,
-            not_first = false;
+            not_first = false,
+            output = ['/*properties'];
         for (i = 0; i < keys.length; i += 1) {
             key = keys[i];
             if (property[key] > 0) {
 
     itself.jslint = itself;
 
-    itself.edition = '2012-09-19';
+    itself.edition = '2012-11-17';
 
     return itself;
 }());