Skip to content

Commit

Permalink
Bugfixing
Browse files Browse the repository at this point in the history
For IE < 9:
Event.prototype.stopImmediatePropagation
Event.prototype.defaultPrevented
FOR IE < 8:
querySelector[All]
  • Loading branch information
termi committed Oct 28, 2012
1 parent 706c3e3 commit df88ff7
Show file tree
Hide file tree
Showing 6 changed files with 229 additions and 249 deletions.
82 changes: 41 additions & 41 deletions __COMPILED/a.ie8.js

Large diffs are not rendered by default.

108 changes: 54 additions & 54 deletions __COMPILED/a.ielt8.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions __COMPILED/a.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 9 additions & 10 deletions __SRC/a.ie8.js
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ _EventInitFunctions = {
_Event_prototype = function_tmp.prototype = {
constructor : function_tmp,

/** @this {_ielt9_Event} */
/** @this {_ielt9_Event} @lends {function_tmp.prototype}*/
"preventDefault" : function() {
if(this.cancelable === false)return;

Expand All @@ -765,19 +765,18 @@ _Event_prototype = function_tmp.prototype = {
this["defaultPrevented"] = true;
} ,

/** @this {_ielt9_Event} */
/** @this {_ielt9_Event} @lends {function_tmp.prototype} */
"stopPropagation" : function() {
_ielt9_Event.getNativeEvent.call(this)["cancelBubble"] = this["cancelBubble"] = true;
_ielt9_Event.destroyLinkToNativeEvent.call(this);
} ,

/** @this {_ielt9_Event} */
"stopImmediatePropagation" : function() {
this["__stopNow"] = true;
this.stopPropagation();
}

}
};
/** @this {_ielt9_Event} */
_Event_prototype["stopImmediatePropagation"] = function() {
this["__stopNow"] = true;
this.stopPropagation();
};
_Event_prototype["defaultPrevented"] = false;

for(_tmp_ in _EventInitFunctions)if(_hasOwnProperty(_EventInitFunctions, _tmp_)) {
_Event_prototype[_tmp_] = function() {
Expand Down
243 changes: 121 additions & 122 deletions __SRC/a.ielt8.js
Original file line number Diff line number Diff line change
Expand Up @@ -687,144 +687,143 @@ if(!("pageXOffset" in global)) {
/* ====================================================================================== */
/* ====================================== Events <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< */

/** @constructor */
function_tmp = global["Event"] = function() {
//new operator for Event supported in a.js
_throw("");
};
/** @constructor */
function_tmp = global["Event"] = function() {
//new operator for Event supported in a.js
_throw("");
};

_EventInitFunctions = {
/**
* @param {string=} _type
* @param {boolean=} _bubbles
* @param {boolean=} _cancelable
*/
"initEvent" : function(_type, _bubbles, _cancelable) {
if(_type == void 0 || _bubbles == void 0 || _cancelable == void 0) {
//WRONG_ARGUMENTS_ERR
_throw('WRONG_ARGUMENTS_ERR');
}
var thisObj = this;
_EventInitFunctions = {
/**
* @param {string=} _type
* @param {boolean=} _bubbles
* @param {boolean=} _cancelable
*/
"initEvent" : function(_type, _bubbles, _cancelable) {
if(_type == void 0 || _bubbles == void 0 || _cancelable == void 0) {
//WRONG_ARGUMENTS_ERR
_throw('WRONG_ARGUMENTS_ERR');
}
var thisObj = this;

thisObj.type = _type;
//this.cancelBubble = //TODO:: <-- testing | Need this ???
// !(this.bubbles = _bubbles);
thisObj.bubbles = _bubbles;
thisObj.cancelable = _cancelable;//https://developer.mozilla.org/en/DOM/event.cancelable
thisObj.type = _type;
//this.cancelBubble = //TODO:: <-- testing | Need this ???
// !(this.bubbles = _bubbles);
thisObj.bubbles = _bubbles;
thisObj.cancelable = _cancelable;//https://developer.mozilla.org/en/DOM/event.cancelable

thisObj.isTrusted = false;
thisObj.target = null;
thisObj.isTrusted = false;
thisObj.target = null;

if(!thisObj.timeStamp)thisObj.timeStamp = +new _Native_Date();
}
,
"initCustomEvent" : function(_type, _bubbles, _cancelable, _detail) {
//https://developer.mozilla.org/en/DOM/CustomEvent
_EventInitFunctions["initEvent"].call(this, _type, _bubbles, _cancelable);
if(!thisObj.timeStamp)thisObj.timeStamp = +new _Native_Date();
}
,
"initCustomEvent" : function(_type, _bubbles, _cancelable, _detail) {
//https://developer.mozilla.org/en/DOM/CustomEvent
_EventInitFunctions["initEvent"].call(this, _type, _bubbles, _cancelable);

this.detail = _detail;
}
,
"initUIEvent" : function(_type, _bubbles, _cancelable, _view, _detail) {
//https://developer.mozilla.org/en/DOM/event.initUIEvent
_EventInitFunctions["initCustomEvent"].call(this, _type, _bubbles, _cancelable, _detail);
this.detail = _detail;
}
,
"initUIEvent" : function(_type, _bubbles, _cancelable, _view, _detail) {
//https://developer.mozilla.org/en/DOM/event.initUIEvent
_EventInitFunctions["initCustomEvent"].call(this, _type, _bubbles, _cancelable, _detail);

this.view = _view;
}
,
"initMouseEvent" : function(_type, _bubbles, _cancelable, _view,
_detail, _screenX, _screenY, _clientX, _clientY,
_ctrlKey, _altKey, _shiftKey, _metaKey,
_button, _relatedTarget) {
var thisObj = this;
//https://developer.mozilla.org/en/DOM/event.initMouseEvent
_EventInitFunctions["initUIEvent"].call(thisObj, _type, _bubbles, _cancelable, _view, _detail);

thisObj.screenX = _screenX;
thisObj.screenY = _screenY;
thisObj.clientX = _clientX;
thisObj.clientY = _clientY;
thisObj.ctrlKey = _ctrlKey;
thisObj.altKey = _altKey;
thisObj.shiftKey = _shiftKey;
thisObj.metaKey = _metaKey;
thisObj.button = _button;
thisObj.relatedTarget = _relatedTarget;
}
};
this.view = _view;
}
,
"initMouseEvent" : function(_type, _bubbles, _cancelable, _view,
_detail, _screenX, _screenY, _clientX, _clientY,
_ctrlKey, _altKey, _shiftKey, _metaKey,
_button, _relatedTarget) {
var thisObj = this;
//https://developer.mozilla.org/en/DOM/event.initMouseEvent
_EventInitFunctions["initUIEvent"].call(thisObj, _type, _bubbles, _cancelable, _view, _detail);

thisObj.screenX = _screenX;
thisObj.screenY = _screenY;
thisObj.clientX = _clientX;
thisObj.clientY = _clientY;
thisObj.ctrlKey = _ctrlKey;
thisObj.altKey = _altKey;
thisObj.shiftKey = _shiftKey;
thisObj.metaKey = _metaKey;
thisObj.button = _button;
thisObj.relatedTarget = _relatedTarget;
}
};

_Event_prototype = function_tmp.prototype = {
constructor : function_tmp,
_Event_prototype = function_tmp.prototype = {
constructor : function_tmp,

/** @this {_ielt9_Event} */
"preventDefault" : function() {
/** @this {_ielt9_Event} @lends {function_tmp.prototype}*/
"preventDefault" : function() {
if(this.cancelable === false)return;

_ielt9_Event.getNativeEvent.call(this)["returnValue"] = this["returnValue"] = false;
_ielt9_Event.destroyLinkToNativeEvent.call(this);
this["defaultPrevented"] = true;
} ,

/** @this {_ielt9_Event} */
"stopPropagation" : function() {
_ielt9_Event.getNativeEvent.call(this)["cancelBubble"] = this["cancelBubble"] = true;
_ielt9_Event.destroyLinkToNativeEvent.call(this);
} ,

/** @this {_ielt9_Event} */
"stopImmediatePropagation" : function() {
this["__stopNow"] = true;
this.stopPropagation();
}
_ielt9_Event.getNativeEvent.call(this)["returnValue"] = this["returnValue"] = false;
_ielt9_Event.destroyLinkToNativeEvent.call(this);
this["defaultPrevented"] = true;
} ,

};
/** @this {_ielt9_Event} @lends {function_tmp.prototype} */
"stopPropagation" : function() {
_ielt9_Event.getNativeEvent.call(this)["cancelBubble"] = this["cancelBubble"] = true;
_ielt9_Event.destroyLinkToNativeEvent.call(this);
}
};
/** @this {_ielt9_Event} */
_Event_prototype["stopImmediatePropagation"] = function() {
this["__stopNow"] = true;
this.stopPropagation();
};
_Event_prototype["defaultPrevented"] = false;

for(_tmp_ in _EventInitFunctions)if(_hasOwnProperty(_EventInitFunctions, _tmp_)) {
_Event_prototype[_tmp_] = function() {
_EventInitFunctions[arguments.callee["name"]].apply(this, arguments);
_safeExtend(this[_event_nativeEventPropName], this);
};
_Event_prototype[_tmp_]["name"] = _tmp_;
}
for(_tmp_ in _EventInitFunctions)if(_hasOwnProperty(_EventInitFunctions, _tmp_)) {
_Event_prototype[_tmp_] = function() {
_EventInitFunctions[arguments.callee["name"]].apply(this, arguments);
_safeExtend(this[_event_nativeEventPropName], this);
};
_Event_prototype[_tmp_]["name"] = _tmp_;
}

/** @constructor Event constructor for document.createEvent and commonHandle */
_ielt9_Event = function(nativeEvent) {
this[_event_nativeEventPropName] = nativeEvent;
/** @constructor Event constructor for document.createEvent and commonHandle */
_ielt9_Event = function(nativeEvent) {
this[_event_nativeEventPropName] = nativeEvent;

nativeEvent.returnValue = true;//default value
nativeEvent.returnValue = true;//default value

_safeExtend(this, nativeEvent);
};
_safeExtend(this, nativeEvent);
};

/** @this {_ielt9_Event} */
_ielt9_Event.getNativeEvent = function() {
var nativeEvent = this[_event_nativeEventPropName];
if(nativeEvent === void 0) {
_throw("WRONG_THIS_ERR")
}
else if(nativeEvent === null) {
//_ielt9_Event.destroyLinkToNativeEvent was fired
nativeEvent = _ielt9_Event.getNativeEvent.fakeObject;
}
/** @this {_ielt9_Event} */
_ielt9_Event.getNativeEvent = function() {
var nativeEvent = this[_event_nativeEventPropName];
if(nativeEvent === void 0) {
_throw("WRONG_THIS_ERR")
}
else if(nativeEvent === null) {
//_ielt9_Event.destroyLinkToNativeEvent was fired
nativeEvent = _ielt9_Event.getNativeEvent.fakeObject;
}

return nativeEvent;
};
_ielt9_Event.getNativeEvent.fakeObject = {};
return nativeEvent;
};
_ielt9_Event.getNativeEvent.fakeObject = {};

/** @this {_ielt9_Event} */
_ielt9_Event.destroyLinkToNativeEvent = function() {
if(this[_event_nativeEventPropName]) {
this[_event_nativeEventPropName] = null;
}
};
/** @this {_ielt9_Event} */
_ielt9_Event.destroyLinkToNativeEvent = function() {
if(this[_event_nativeEventPropName]) {
this[_event_nativeEventPropName] = null;
}
};

//inherit _ielt9_Event from Event
/** @constructor */
function_tmp = function() { };
function_tmp.prototype = _Event_prototype;
function_tmp = new function_tmp;
function_tmp.constructor = _ielt9_Event;
_ielt9_Event.prototype = function_tmp;
//inherit _ielt9_Event from Event
/** @constructor */
function_tmp = function() { };
function_tmp.prototype = _Event_prototype;
function_tmp = new function_tmp;
function_tmp.constructor = _ielt9_Event;
_ielt9_Event.prototype = function_tmp;


//fix [add|remove]EventListener & dispatchEvent for IE < 9
Expand Down Expand Up @@ -2462,7 +2461,7 @@ function queryOneSelector(selector, roots, globalResult, globalResultAsSparseArr
, /** @type {Node} */brother
, /** @type {number} */combinatorType = selectorCombinatorTypeMap[selectorArr[1] || ""] || 0
, /** @type {boolean} */combinatorTypeMoreThen_2 = combinatorType > 2
, /** @type {(string|undefined)} */tag = selectorArr[2]
, /** @type {(string|undefined)} */tag = selectorArr[2] || "*"
, /** @type {boolean} */needCheck_tag = !!tag
, /** @type {(string|undefined)} */id = selectorArr[3]
, /** @type {boolean} */needCheck_id = !!id
Expand Down Expand Up @@ -2550,7 +2549,7 @@ function queryOneSelector(selector, roots, globalResult, globalResultAsSparseArr
}
}

preResult = needCheck_id = void 0;
preResult = needCheck_id = needCheck_tag = void 0;
}
}

Expand All @@ -2570,7 +2569,7 @@ function queryOneSelector(selector, roots, globalResult, globalResultAsSparseArr
canWeReturnUnsafeArray = canWeReturnUnsafeArray && !needCheck_classes;
}
else {
preResult = root.getElementsByTagName(tag || "*");
preResult = root.getElementsByTagName(tag);
}
}
else {//id
Expand Down
22 changes: 2 additions & 20 deletions __SRC/a.js
Original file line number Diff line number Diff line change
Expand Up @@ -2194,28 +2194,10 @@ if(!_tmp_) {
// DOMTokenList.prototype.toggle(token, force)
(function(_old_add, _old_remove) {
_tmp_["add"] = function() {
var tokens = arguments
, token
, i = 0
, l = tokens.length
;
do {
token = tokens[i];
_old_add.call(this, token);
}
while(++i < l);
_forEach(arguments, _old_add, this);
};
_tmp_["remove"] = function() {
var tokens = arguments
, token
, i = 0
, l = tokens.length
;
do {
token = tokens[i];
_old_remove.call(this, token);
}
while(++i < l);
_forEach(arguments, _old_remove, this);
};
_tmp_["toggle"] = DOMStringCollection.prototype["toggle"];
})(_tmp_["add"], _tmp_["remove"]);
Expand Down

0 comments on commit df88ff7

Please sign in to comment.