Added IE event.preventDefault polyfill
This commit is contained in:
parent
9205532e79
commit
69fb63a983
@ -148,7 +148,7 @@
|
||||
<span class='line'>141</span>
|
||||
<span class='line'>142</span> </span><span class="WHIT"> </span><span class="NAME">_attach_delegate</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>143</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>144</span> </span><span class="WHIT"> </span><span class="COMM">//_attach the _listener to the parent object</span><span class="WHIT">
|
||||
<span class='line'>144</span> </span><span class="WHIT"> </span><span class="COMM">// attach the listener to the parent object</span><span class="WHIT">
|
||||
<span class='line'>145</span> </span><span class="WHIT"> </span><span class="NAME">_add_remove</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>146</span> </span><span class="WHIT">
|
||||
<span class='line'>147</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">elem</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">tar</span><span class="PUNC">;</span><span class="WHIT">
|
||||
@ -250,7 +250,7 @@
|
||||
<span class='line'>243</span> * @param string event_type
|
||||
<span class='line'>244</span> * @param function callback
|
||||
<span class='line'>245</span> */</span><span class="WHIT">
|
||||
<span class='line'>246</span> </span><span class="WHIT"> </span><span class="NAME">delegate</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>246</span> </span><span class="WHIT"> </span><span class="NAME">delegate</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>247</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>248</span> </span><span class="WHIT"> </span><span class="NAME">$_.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>249</span> </span><span class="WHIT"> </span><span class="NAME">_attach_delegate</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
|
@ -360,10 +360,11 @@
|
||||
<span class='line'>353</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">new_str</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>354</span> </span><span class="WHIT">
|
||||
<span class='line'>355</span> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>356</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>357</span>
|
||||
<span class='line'>358</span> </span><span class="WHIT"> </span><span class="COMM">//Add it to the $_ object</span><span class="WHIT">
|
||||
<span class='line'>359</span> </span><span class="WHIT"> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'util'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>360</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>361</span>
|
||||
<span class='line'>362</span> </span></pre></body></html>
|
||||
<span class='line'>356</span> </span><span class="WHIT">
|
||||
<span class='line'>357</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>358</span>
|
||||
<span class='line'>359</span> </span><span class="WHIT"> </span><span class="COMM">//Add it to the $_ object</span><span class="WHIT">
|
||||
<span class='line'>360</span> </span><span class="WHIT"> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'util'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>361</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>362</span>
|
||||
<span class='line'>363</span> </span></pre></body></html>
|
22
kis-all.js
22
kis-all.js
@ -411,6 +411,25 @@
|
||||
|
||||
}(self));
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* event.preventDefault/e.stopPropagation polyfill
|
||||
* @private
|
||||
*/
|
||||
if(typeof Event.preventDefault === "undefined" && typeof window.event !== "undefined")
|
||||
{
|
||||
Event.prototype.preventDefault = function()
|
||||
{
|
||||
window.event.stop();
|
||||
},
|
||||
Event.prototype.stopPropagation = function()
|
||||
{
|
||||
window.event.returnValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
}());
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@ -1338,6 +1357,7 @@
|
||||
return new_str;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//Add it to the $_ object
|
||||
@ -1490,7 +1510,7 @@
|
||||
|
||||
_attach_delegate = function(sel, target, event, callback)
|
||||
{
|
||||
//_attach the _listener to the parent object
|
||||
// attach the listener to the parent object
|
||||
_add_remove(sel, event, function(e){
|
||||
|
||||
var elem, t, tar;
|
||||
|
2
kis-min.js
vendored
2
kis-min.js
vendored
@ -4,7 +4,7 @@ return b.length===1?b[0]:b};d=function(a){var c;if(typeof a!=="undefined"){if(ty
|
||||
(function(){if(typeof window.console==="undefined")window.console={log:function(){}};if(typeof String.prototype.trim==="undefined")String.prototype.trim=function(){return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")};typeof document!=="undefined"&&!("classList"in document.createElement("a"))&&function(f){var f=(f.HTMLElement||f.Element).prototype,g=Object,d=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},b=Array.prototype.indexOf||function(a){for(var c=0,b=this.length;c<b;c++)if(c in
|
||||
this&&this[c]===a)return c;return-1},a=function(a,c){this.name=a;this.code=DOMException[a];this.message=c},c=function(c,e){if(e==="")throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(e))throw new a("INVALID_CHARACTER_ERR","String contains an invalid character");return b.call(c,e)},e=function(a){for(var c=d.call(a.className),c=c?c.split(/\s+/):[],b=0,e=c.length;b<e;b++)this.push(c[b]);this._updateClassName=function(){a.className=this.toString()}},i=e.prototype=[],
|
||||
h=function(){return new e(this)};a.prototype=Error.prototype;i.item=function(a){return this[a]||null};i.contains=function(a){a+="";return c(this,a)!==-1};i.add=function(a){a+="";c(this,a)===-1&&(this.push(a),this._updateClassName())};i.remove=function(a){a+="";a=c(this,a);a!==-1&&(this.splice(a,1),this._updateClassName())};i.toggle=function(a){a+="";c(this,a)===-1?this.add(a):this.remove(a)};i.toString=function(){return this.join(" ")};if(g.defineProperty){i={get:h,enumerable:true,configurable:true};
|
||||
try{g.defineProperty(f,"classList",i)}catch(k){if(k.number===-2146823252)i.enumerable=false,g.defineProperty(f,"classList",i)}}else g.prototype.__defineGetter__&&f.__defineGetter__("classList",h)}(self)})();
|
||||
try{g.defineProperty(f,"classList",i)}catch(k){if(k.number===-2146823252)i.enumerable=false,g.defineProperty(f,"classList",i)}}else g.prototype.__defineGetter__&&f.__defineGetter__("classList",h)}(self);if(typeof Event.preventDefault==="undefined"&&typeof window.event!=="undefined")Event.prototype.preventDefault=function(){window.event.stop()},Event.prototype.stopPropagation=function(){window.event.returnValue=false}})();
|
||||
(function(){function f(b,a,c){var e,d;if(typeof b.hasAttribute!=="undefined")b.hasAttribute(a)&&(e=b.getAttribute(a)),d=true;else if(typeof b[a]!=="undefined")e=b[a],d=false;else if(a==="class"&&typeof b.className!=="undefined")a="className",e=b.className,d=false;if(typeof e==="undefined"&&(typeof c==="undefined"||c===null))console.log(c),console.log(b),console.log("Element does not have the selected attribute");else{if(typeof c==="undefined")return e;typeof c!=="undefined"&&c!==null?d===true?b.setAttribute(a,
|
||||
c):b[a]=c:c===null&&(d===true?b.removeAttribute(a):delete b[a]);return typeof c!=="undefined"?c:e}}function g(b){return b.replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")})}function d(b,a,c){var e,a=g(a);e={outerHeight:"offsetHeight",outerWidth:"offsetWidth",top:"posTop"};if(typeof c==="undefined"&&b.style[a]!=="undefined")return b.style[a];else if(typeof c==="undefined"&&b.style[e[a]]!=="undefined")return b.style[e[a]];typeof b.style[a]!=="undefined"?b.style[a]=c:b.style[e[a]]?
|
||||
b.style[e[a]]=c:console.log("Property "+a+" nor an equivalent seems to exist")}$_.ext("dom",{addClass:function(b){$_.each(function(a){a.classList.add(b)})},removeClass:function(b){$_.each(function(a){a.classList.remove(b)})},hide:function(){this.css("display","none")},show:function(b){typeof b==="undefined"&&(b="block");this.css("display",b)},attr:function(b,a){var c=this.el;if(c.length>1&&typeof a==="undefined")console.log(c),console.log("Must be a singular element");else if(c.length>1&&typeof a!==
|
||||
|
@ -141,7 +141,7 @@
|
||||
|
||||
_attach_delegate = function(sel, target, event, callback)
|
||||
{
|
||||
//_attach the _listener to the parent object
|
||||
// attach the listener to the parent object
|
||||
_add_remove(sel, event, function(e){
|
||||
|
||||
var elem, t, tar;
|
||||
|
@ -353,6 +353,7 @@
|
||||
return new_str;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//Add it to the $_ object
|
||||
|
@ -198,4 +198,23 @@
|
||||
|
||||
}(self));
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* event.preventDefault/e.stopPropagation polyfill
|
||||
* @private
|
||||
*/
|
||||
if(typeof Event.preventDefault === "undefined" && typeof window.event !== "undefined")
|
||||
{
|
||||
Event.prototype.preventDefault = function()
|
||||
{
|
||||
window.event.stop();
|
||||
},
|
||||
Event.prototype.stopPropagation = function()
|
||||
{
|
||||
window.event.returnValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
}());
|
Loading…
Reference in New Issue
Block a user