Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

simplified error handler now just throws a standard 'SyntaxError'

  • Loading branch information...
commit 43b8c7bfe28bbeb9c2b2ca137e5a0c9c7fe249fa 1 parent 354e59e
@dperini authored
View
9 src/nwmatcher-base.js
@@ -210,16 +210,9 @@
emit =
function(message) {
- var err;
message = 'SYNTAX_ERR: ' + message + ' ';
if (Config.VERBOSITY) {
- if (typeof global.DOMException != 'undefined') {
- err = SyntaxError(message);
- err.code = 12;
- } else {
- err = Error(12, message);
- }
- throw err;
+ throw SyntaxError(message);
} else {
if (global.console && global.console.log) {
global.console.log(message);
View
10 src/nwmatcher.js
@@ -823,17 +823,9 @@
// control user notifications
emit =
function(message) {
- var err;
message = 'SYNTAX_ERR: ' + message + ' ';
if (Config.VERBOSITY) {
- // FF/Safari/Opera DOMException.SYNTAX_ERR = 12
- if (typeof global.DOMException != 'undefined') {
- err = new SyntaxError(message);
- err.code = 12;
- } else {
- err = new Error(12, message);
- }
- throw err;
+ throw new SyntaxError(message);
} else {
if (global.console && global.console.log) {
global.console.log(message);
View
12 test/W3C-Selector-tests/W3C-Selector-tests-nwmatcher.html
@@ -353,7 +353,7 @@
var pass = false;
try {
$("", root);
- } catch(e){ pass = typeof DOMException !== "undefined" && e.code == DOMException.SYNTAX_ERR || e.number == 12; }
+ } catch(e){ pass = /syntax|error/i.test(e.name); }
assert( pass, type + ".querySelectorAll Empty String" );
pass = false;
@@ -378,7 +378,7 @@
var pass = false;
try {
$("", root)[0];
- } catch(e){ pass = typeof DOMException !== "undefined" && e.code == DOMException.SYNTAX_ERR || e.number == 12; }
+ } catch(e){ pass = /syntax|error/i.test(e.name); }
assert( pass, type + ".querySelector Empty String" );
pass = false;
@@ -416,7 +416,7 @@
assert(expect && pass, type + ".querySelectorAll: " + query);
} catch(e){
- var pass = !expect && typeof DOMException !== "undefined" && e.code == DOMException.SYNTAX_ERR || e.number == 12;
+ var pass = !expect && /syntax|error/i.test(e.name);
assert(pass, type + ".querySelectorAll: " + query);
}
@@ -439,7 +439,7 @@
assert(expect, type + ".querySelector: " + query);
} catch(e){
- var pass = !expect && typeof DOMException !== "undefined" && e.code == DOMException.SYNTAX_ERR || e.number == 12;
+ var pass = !expect && /syntax|error/i.test(e.name);
assert(pass, type + ".querySelector: " + query);
}
}
@@ -492,7 +492,7 @@
try {
return $(q, root);
} catch(e) {
- if (typeof DOMException !== "undefined" && (e.code == DOMException.NAMESPACE_ERR || e.code == DOMException.SYNTAX_ERR) || e.number == 12)
+ if (/syntax|error/i.test(e.name))
throw e;
}
}
@@ -513,7 +513,7 @@
var results = query(q);
pass = hasPassed( results, ids );
} catch(e) {
- pass = typeof DOMException !== "undefined" && e.code == DOMException.SYNTAX_ERR || e.number == 12;
+ pass = /syntax|error/i.test(e.name);
}
assert( pass, type + ": " + name + " (" + nq + ")" +
View
4 test/jquery/unit/selector.js
@@ -63,12 +63,12 @@ if ( location.protocol != "file:" ) {
}
*/
test("broken", function() {
- expect(12);
+ expect(13);
function broken(name, selector) {
try {
t(name, selector, [ ]);
} catch(e){
- ok( typeof e === "object" && e.code == 12 || e.number == 12,
+ ok( 'SyntaxError' == e.name,
name + ": " + selector );
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.