Comparing version 0.8.4 to 0.8.5
@@ -291,7 +291,12 @@ ( function( global, factory ) { | ||
this.ready = function(f) { if (f) { | ||
if (window.addEventListener) | ||
window.document.addEventListener('DOMContentLoaded', f); | ||
else | ||
window.document.attachEvent('onload', f); | ||
return _this; } } | ||
if (window.addEventListener) | ||
window.document.addEventListener('DOMContentLoaded', f); | ||
else | ||
window.document.attachEvent('onload', f); | ||
} | ||
else { | ||
_this.trigger('ready'); | ||
} | ||
return _this; | ||
} | ||
this.unload = function(f) { if (f) { | ||
@@ -302,3 +307,8 @@ if (window.addEventListener) | ||
window.document.attachEvent('onunload', f); | ||
return _this; } } | ||
} | ||
else { | ||
_this.trigger('unload'); | ||
} | ||
return _this; | ||
} | ||
this.context = window.document; | ||
@@ -312,3 +322,8 @@ } | ||
window.attachEvent('onunload', f); | ||
return _this; } } | ||
} | ||
else { | ||
_this.trigger('unload'); | ||
} | ||
return _this; | ||
} | ||
} | ||
@@ -320,6 +335,13 @@ else { | ||
if (typeof name === 'function') { | ||
function foo(e){ | ||
name.bind(_this)(e); | ||
if (window.addEventListener) | ||
window.document.removeEventListener('DOMContentLoaded', foo); | ||
else | ||
window.document.detachEvent('onload', foo); | ||
} | ||
if (window.addEventListener) | ||
window.document.addEventListener('DOMContentLoaded', name); | ||
window.document.addEventListener('DOMContentLoaded', foo); | ||
else | ||
window.document.attachEvent('onload', name); | ||
window.document.attachEvent('onload', foo); | ||
} | ||
@@ -356,10 +378,2 @@ else { | ||
// plugin. | ||
for (const key in CreateDom.fn) { | ||
if (key == 'extend' || key == 'fn') continue; | ||
if (typeof CreateDom.fn[key] === 'function') { | ||
this[key] = CreateDom.fn[key].bind(this); | ||
} | ||
} | ||
if (this._elem) { | ||
@@ -374,2 +388,11 @@ if (this._isArray()) { | ||
} | ||
// plugin. | ||
for (const key in CreateDom.fn) { | ||
if (key == 'extend' || key == 'fn') continue; | ||
if (typeof CreateDom.fn[key] === 'function') { | ||
this[key] = CreateDom.fn[key].bind(this); | ||
} | ||
} | ||
this.__domtify = true; | ||
} | ||
@@ -470,9 +493,2 @@ | ||
// for ie. | ||
for (var i = 0; i < _dom.length; i++) { | ||
if (_dom[i].getAttribute('disabled') == '') { | ||
_dom[i].removeAttribute('disabled'); | ||
} | ||
} | ||
return this; | ||
@@ -499,9 +515,2 @@ } | ||
// for ie. | ||
for (var i = 0; i < _dom.length; i++) { | ||
if (_dom[i].getAttribute('disabled') == '') { | ||
_dom[i].removeAttribute('disabled'); | ||
} | ||
} | ||
return this; | ||
@@ -533,9 +542,2 @@ } | ||
} | ||
// for ie. | ||
for (var i = 0; i < _dom.length; i++) { | ||
if (_dom[i].getAttribute('disabled') == '') { | ||
_dom[i].removeAttribute('disabled'); | ||
} | ||
} | ||
@@ -574,9 +576,2 @@ return this; | ||
} | ||
// for ie. | ||
for (var i = 0; i < _dom.length; i++) { | ||
if (_dom[i].getAttribute('disabled') == '') { | ||
_dom[i].removeAttribute('disabled'); | ||
} | ||
} | ||
@@ -606,2 +601,6 @@ return this; | ||
attr(attrName, value) { | ||
if (!attrName) { | ||
throw new Error('need attrName'); | ||
} | ||
if (!this._elem) { | ||
@@ -613,2 +612,5 @@ if (typeof value !== 'undefined') | ||
if (typeof value === 'undefined') { | ||
if (!this.get(0).hasAttribute(attrName)) | ||
return undefined; | ||
return this.get(0).getAttribute(attrName); | ||
@@ -1178,7 +1180,7 @@ } else { | ||
return; | ||
if (node._domtify) | ||
if (node.__domtify) | ||
return; | ||
var _proto = Object.getPrototypeOf(this); | ||
for (const key in _proto) { | ||
for (var key in _proto) { | ||
if (key != '__proto__' && key != 'constructor') { | ||
@@ -1191,20 +1193,15 @@ // 不覆盖native方法. | ||
} | ||
for (const key in this) { | ||
if (key != '__proto__' && key != 'constructor' && typeof this[key] === 'function') { | ||
// 不覆盖native方法. | ||
if (!node[key]) { | ||
node[key] = this[key].bind(node); | ||
} | ||
} | ||
} | ||
// plugin. | ||
for (const key in CreateDom.fn) { | ||
// // plugin. | ||
for (var key in CreateDom.fn) { | ||
if (key == 'extend' || key == 'fn') continue; | ||
if (typeof CreateDom.fn[key] === 'function') { | ||
node[key] = CreateDom.fn[key].bind(node); | ||
if (!node[key]) { | ||
node[key] = CreateDom.fn[key].bind(node); | ||
} | ||
} | ||
} | ||
delete node.length; | ||
// delete node.length; | ||
node._isArr = false; | ||
@@ -1214,6 +1211,2 @@ node._elem = node; | ||
node.__domtify = true; | ||
if (node != window) { | ||
node.context = window.document; | ||
} | ||
} | ||
@@ -1220,0 +1213,0 @@ |
@@ -86,3 +86,3 @@ { | ||
"name": "febs", | ||
"version": "0.8.4" | ||
"version": "0.8.5" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1674782
16957