兼容ie9

This commit is contained in:
张磊 2015-06-21 13:55:42 +08:00
parent 4a54a7455a
commit 0a59e69cb7
3 changed files with 71 additions and 6 deletions

36
dist/nuclear.js vendored
View File

@ -1179,8 +1179,6 @@ var Nuclear = (function () {
})(Nuclear);
; (function ($) {
var touch = {},
touchTimeout, tapTimeout, swipeTimeout, longTapTimeout,
@ -1343,7 +1341,41 @@ var Nuclear = (function () {
})
})(Nuclear)
; (function ($) {
// __proto__ doesn't exist on IE<11, so redefine
// the Z function to use object extension instead
if (!('__proto__' in {})) {
alert(11111)
$.extend($.nuclear, {
Z: function (dom, selector) {
dom = dom || []
$.extend(dom, $.fn)
dom.selector = selector || ''
dom.__Z = true
return dom
},
// this is a kludge but works
isZ: function (object) {
return $.type(object) === 'array' && '__Z' in object
}
})
}
// getComputedStyle shouldn't freak out when called
// without a valid element as argument
try {
getComputedStyle(undefined)
} catch (e) {
var nativeGetComputedStyle = getComputedStyle;
window.getComputedStyle = function (element) {
try {
return nativeGetComputedStyle(element)
} catch (e) {
return null
}
}
}
})(Nuclear)
Nuclear.create = function (obj) {
Nuclear._mixObj(obj);
if (!obj.statics) obj.statics = {};

4
dist/nuclear.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1160,8 +1160,6 @@ var Nuclear = (function () {
})(Nuclear);
; (function ($) {
var touch = {},
touchTimeout, tapTimeout, swipeTimeout, longTapTimeout,
@ -1324,3 +1322,38 @@ var Nuclear = (function () {
})
})(Nuclear)
; (function ($) {
// __proto__ doesn't exist on IE<11, so redefine
// the Z function to use object extension instead
if (!('__proto__' in {})) {
alert(11111)
$.extend($.nuclear, {
Z: function (dom, selector) {
dom = dom || []
$.extend(dom, $.fn)
dom.selector = selector || ''
dom.__Z = true
return dom
},
// this is a kludge but works
isZ: function (object) {
return $.type(object) === 'array' && '__Z' in object
}
})
}
// getComputedStyle shouldn't freak out when called
// without a valid element as argument
try {
getComputedStyle(undefined)
} catch (e) {
var nativeGetComputedStyle = getComputedStyle;
window.getComputedStyle = function (element) {
try {
return nativeGetComputedStyle(element)
} catch (e) {
return null
}
}
}
})(Nuclear)