agenda-libre-ruby/public/webshims/1.15.9/shims/form-shim-extend2.js

1 line
18 KiB
JavaScript
Raw Normal View History

webshims.register("form-shim-extend2",function(a,b,c,d,e,f){"use strict";var g=function(a){return"number"==typeof a||a&&a==1*a},h=b.support,i=!("getSetAttribute"in a.support&&!a.support.getSetAttribute),j=!("submitBubbles"in a.support)||a.support.submitBubbles,k=function(b){j||!b||"object"!=typeof b||b._submit_attached||(a.event.add(b,"submit._submit",function(a){a._submit_bubble=!0}),b._submit_attached=!0)};if(!j&&a.event.special.submit&&(a.event.special.submit.setup=function(){return a.nodeName(this,"form")?!1:void a.event.add(this,"click._submit keypress._submit",function(b){var c=b.target,d=a.nodeName(c,"input")||a.nodeName(c,"button")?a.prop(c,"form"):e;k(d)})}),b.reflectProperties(["input"],["pattern"]),!("maxLength"in d.createElement("textarea"))){var l=function(){var b,c=0,d=a([]),e=1e9,f=function(){var a=d.prop("value"),b=a.length;b>c&&b>e&&(b=Math.max(c,e),d.prop("value",a.substr(0,b))),c=b},g=function(){clearTimeout(b),d.off(".maxlengthconstraint")};return function(h,i){g(),i>-1&&(e=i,c=a.prop(h,"value").length,d=a(h),d.on({"keydown.maxlengthconstraint keypress.maxlengthconstraint paste.maxlengthconstraint cut.maxlengthconstraint":function(){setTimeout(f,0)},"keyup.maxlengthconstraint":f,"blur.maxlengthconstraint":g}),b=setInterval(f,200))}}();l.update=function(b,c){a(b).is(":focus")&&(c||(c=a.prop(b,"maxlength")),l(b,c))},a(d).on("focusin",function(b){var c;"TEXTAREA"==b.target.nodeName&&(c=a.prop(b.target,"maxlength"))>-1&&l(b.target,c)}),b.defineNodeNameProperty("textarea","maxlength",{attr:{set:function(a){this.setAttribute("maxlength",""+a),l.update(this)},get:function(){var a=this.getAttribute("maxlength");return null==a?e:a}},prop:{set:function(a){if(g(a)){if(0>a)throw"INDEX_SIZE_ERR";return a=parseInt(a,10),this.setAttribute("maxlength",a),void l.update(this,a)}this.setAttribute("maxlength","0"),l.update(this,0)},get:function(){var a=this.getAttribute("maxlength");return g(a)&&a>=0?parseInt(a,10):-1}}}),b.defineNodeNameProperty("textarea","maxLength",{prop:{set:function(b){a.prop(this,"maxlength",b)},get:function(){return a.prop(this,"maxlength")}}})}i||null!=a("<form novalidate></form>").attr("novalidate")||b.defineNodeNameProperty("form","novalidate",{attr:{set:function(a){this.setAttribute("novalidate",""+a)},get:function(){var a=this.getAttribute("novalidate");return null==a?e:a}}}),h.fieldsetdisabled&&h.fieldsetelements||!function(){if(!h.fieldsetdisabled){var f="isDisabled"in d.createElement("div"),g={fieldset:1,FIELDSET:1},i="input, textarea, select, button",j=function(b){return f&&!b.isDisabled?!1:a.find.matchesSelector(b,"fieldset[disabled] *")},l=f?function(){return this.isDisabled&&a.find.matchesSelector(this,"fieldset[disabled] *")}:"fieldset[disabled] *",m=f?function(){return!this.isDisabled&&!a.find.matchesSelector(this,"fieldset[disabled] *")}:":not(fieldset[disabled] *)";a.extend(a.expr[":"],{enabled:function(a){return g[a.nodeName]?null==b.contentAttr(a,"disabled")&&!j(a):a.disabled===!1},disabled:function(a){return g[a.nodeName]?null!=b.contentAttr(a,"disabled")||j(a):a.disabled===!0}});var n={disable:function(){this.disabled||(b.data(this,"groupedisabled",!0),this.disabled=!0)},enable:function(){this.disabled&&b.data(this,"groupedisabled")&&(b.data(this,"groupedisabled",!1),this.disabled=!1)}};a(c).on("unload",function(){a(i).each(n.enable)}),b.defineNodeNamesBooleanProperty(["fieldset"],"disabled",{set:function(b){if(b=!!b)a(this.querySelectorAll(i)).each(n.disable);else if(!j(this)){var c=a(this.querySelectorAll(i));this.querySelector("fieldset[disabled]")&&(c=c.filter(m)),c.each(n.enable)}},initAttr:!0,useContentAttribute:!0}),["input","textarea","select","button"].forEach(function(a){var c=b.defineNodeNameProperty(a,"disabled",{prop:{set:function(a){a?(b.data(this,"groupedisabled",!1),c.prop._supset.call(this,a)):j(this)?(b.data(this,"groupedisabled",!0),c.prop._supset.call(this,!0)):(b.data(this,"groupedisabled",!1),c.prop._supset.call(this,a))},get:function(){var a=c.prop._supget.call(this);return a?!b.data(this,"groupedisabled"):a}},removeAttr:{value:function(){c.prop.set.cal