Skip to content

Commit

Permalink
No longer use arguments.callee or RegExp (use new RegExp, instead) fo…
Browse files Browse the repository at this point in the history
…r ES 3.1 and Caja compatibility. Fixes jQuery bug #4251.
  • Loading branch information
jeresig committed Feb 26, 2009
1 parent 410e13b commit 985856b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/event.js
Expand Up @@ -116,7 +116,7 @@ jQuery.event = {
// Namespaced event handlers
var namespaces = type.split(".");
type = namespaces.shift();
var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
var namespace = new RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");

if ( events[type] ) {
// remove the given handler for the given type
Expand Down Expand Up @@ -249,7 +249,7 @@ jQuery.event = {
// Cache this now, all = true means, any handler
all = !namespaces.length && !event.exclusive;

var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
var namespace = new RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");

handlers = ( jQuery.data(this, "events") || {} )[event.type];

Expand Down Expand Up @@ -354,7 +354,7 @@ jQuery.event = {
},
teardown: function( namespaces ){
if ( namespaces.length ) {
var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)");
var remove = 0, name = new RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)");

jQuery.each( (jQuery.data(this, "events").live || {}), function(){
if ( name.test(this.type) )
Expand Down Expand Up @@ -560,7 +560,7 @@ jQuery.fn.extend({
});

function liveHandler( event ){
var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"),
var check = new RegExp("(^|\\.)" + event.type + "(\\.|$)"),
stop = true,
elems = [];

Expand Down
2 changes: 1 addition & 1 deletion src/selector.js
Expand Up @@ -659,7 +659,7 @@ var Expr = Sizzle.selectors = {
var origPOS = Expr.match.POS;

for ( var type in Expr.match ) {
Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
}

var makeArray = function(array, results) {
Expand Down
4 changes: 2 additions & 2 deletions src/support.js
Expand Up @@ -75,11 +75,11 @@
root.removeChild( script );

if ( div.attachEvent && div.fireEvent ) {
div.attachEvent("onclick", function(){
div.attachEvent("onclick", function click(){
// Cloning a node shouldn't copy over any
// bound event handlers (IE does this)
jQuery.support.noCloneEvent = false;
div.detachEvent("onclick", arguments.callee);
div.detachEvent("onclick", click);
});
div.cloneNode(true).fireEvent("onclick");
}
Expand Down

0 comments on commit 985856b

Please sign in to comment.