polymer-gold-rails 1.0.0.pre.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +36 -0
- data/Rakefile +1 -0
- data/app/assets/components/gold-cc-cvc-input/README.md +24 -0
- data/app/assets/components/gold-cc-cvc-input/bower.json +39 -0
- data/app/assets/components/gold-cc-cvc-input/cvc_hint.png +0 -0
- data/app/assets/components/gold-cc-cvc-input/cvc_hint_amex.png +0 -0
- data/app/assets/components/gold-cc-cvc-input/demo/index.html +54 -0
- data/app/assets/components/gold-cc-cvc-input/gold-cc-cvc-input.html +195 -0
- data/app/assets/components/gold-cc-cvc-input/hero.svg +36 -0
- data/app/assets/components/gold-cc-cvc-input/index.html +26 -0
- data/app/assets/components/gold-cc-cvc-input/test/basic.html +125 -0
- data/app/assets/components/gold-cc-cvc-input/test/index.html +25 -0
- data/app/assets/components/gold-cc-expiration-input/README.md +10 -0
- data/app/assets/components/gold-cc-expiration-input/bower.json +40 -0
- data/app/assets/components/gold-cc-expiration-input/date-input.html +157 -0
- data/app/assets/components/gold-cc-expiration-input/date-validator.html +38 -0
- data/app/assets/components/gold-cc-expiration-input/demo/index.html +53 -0
- data/app/assets/components/gold-cc-expiration-input/gold-cc-expiration-input.html +131 -0
- data/app/assets/components/gold-cc-expiration-input/hero.svg +58 -0
- data/app/assets/components/gold-cc-expiration-input/index.html +28 -0
- data/app/assets/components/gold-cc-expiration-input/test/basic.html +126 -0
- data/app/assets/components/gold-cc-expiration-input/test/index.html +25 -0
- data/app/assets/components/gold-cc-input/README.md +9 -0
- data/app/assets/components/gold-cc-input/bower.json +39 -0
- data/app/assets/components/gold-cc-input/cc-validator.js +192 -0
- data/app/assets/components/gold-cc-input/demo/index.html +48 -0
- data/app/assets/components/gold-cc-input/gold-cc-input.html +215 -0
- data/app/assets/components/gold-cc-input/hero.svg +52 -0
- data/app/assets/components/gold-cc-input/images/amex.png +0 -0
- data/app/assets/components/gold-cc-input/images/diners_club.png +0 -0
- data/app/assets/components/gold-cc-input/images/discover.png +0 -0
- data/app/assets/components/gold-cc-input/images/jcb.png +0 -0
- data/app/assets/components/gold-cc-input/images/mastercard.png +0 -0
- data/app/assets/components/gold-cc-input/images/visa.png +0 -0
- data/app/assets/components/gold-cc-input/index.html +28 -0
- data/app/assets/components/gold-cc-input/test/basic.html +136 -0
- data/app/assets/components/gold-cc-input/test/index.html +25 -0
- data/app/assets/components/gold-elements/README.md +12 -0
- data/app/assets/components/gold-elements/bower.json +42 -0
- data/app/assets/components/gold-elements/demo/complex-form.html +127 -0
- data/app/assets/components/gold-elements/demo/index.html +94 -0
- data/app/assets/components/gold-elements/demo/item-card.html +59 -0
- data/app/assets/components/gold-elements/demo/simple-form.css +55 -0
- data/app/assets/components/gold-elements/demo/simple-form.html +93 -0
- data/app/assets/components/gold-elements/screenshot.png +0 -0
- data/app/assets/components/gold-email-input/README.md +8 -0
- data/app/assets/components/gold-email-input/bower.json +40 -0
- data/app/assets/components/gold-email-input/demo/index.html +46 -0
- data/app/assets/components/gold-email-input/email-validator.html +31 -0
- data/app/assets/components/gold-email-input/gold-email-input.html +108 -0
- data/app/assets/components/gold-email-input/hero.svg +59 -0
- data/app/assets/components/gold-email-input/index.html +28 -0
- data/app/assets/components/gold-email-input/test/basic.html +97 -0
- data/app/assets/components/gold-email-input/test/index.html +25 -0
- data/app/assets/components/gold-phone-input/README.md +13 -0
- data/app/assets/components/gold-phone-input/bower.json +39 -0
- data/app/assets/components/gold-phone-input/demo/index.html +53 -0
- data/app/assets/components/gold-phone-input/gold-phone-input.html +197 -0
- data/app/assets/components/gold-phone-input/hero.svg +63 -0
- data/app/assets/components/gold-phone-input/index.html +28 -0
- data/app/assets/components/gold-phone-input/test/basic.html +117 -0
- data/app/assets/components/gold-phone-input/test/index.html +25 -0
- data/app/assets/components/gold-zip-input/README.md +8 -0
- data/app/assets/components/gold-zip-input/bower.json +40 -0
- data/app/assets/components/gold-zip-input/demo/index.html +54 -0
- data/app/assets/components/gold-zip-input/gold-zip-input.html +113 -0
- data/app/assets/components/gold-zip-input/hero.svg +43 -0
- data/app/assets/components/gold-zip-input/index.html +28 -0
- data/app/assets/components/gold-zip-input/test/basic.html +116 -0
- data/app/assets/components/gold-zip-input/test/index.html +25 -0
- data/app/assets/components/gold-zip-input/zip-validator.html +32 -0
- data/app/assets/components/iron-autogrow-textarea/README.md +24 -0
- data/app/assets/components/iron-autogrow-textarea/bower.json +37 -0
- data/app/assets/components/iron-autogrow-textarea/demo/index.html +81 -0
- data/app/assets/components/iron-autogrow-textarea/hero.svg +33 -0
- data/app/assets/components/iron-autogrow-textarea/index.html +30 -0
- data/app/assets/components/iron-autogrow-textarea/iron-autogrow-textarea.html +263 -0
- data/app/assets/components/iron-autogrow-textarea/test/basic.html +94 -0
- data/app/assets/components/iron-autogrow-textarea/test/index.html +25 -0
- data/app/assets/components/iron-flex-layout/README.md +4 -0
- data/app/assets/components/iron-flex-layout/bower.json +21 -0
- data/app/assets/components/iron-flex-layout/classes/iron-flex-layout.html +307 -0
- data/app/assets/components/iron-flex-layout/classes/iron-shadow-flex-layout.html +302 -0
- data/app/assets/components/iron-flex-layout/demo/index.html +40 -0
- data/app/assets/components/iron-flex-layout/demo/x-app.html +106 -0
- data/app/assets/components/iron-flex-layout/iron-flex-layout.html +313 -0
- data/app/assets/components/iron-form-element-behavior/README.md +2 -0
- data/app/assets/components/iron-form-element-behavior/bower.json +27 -0
- data/app/assets/components/iron-form-element-behavior/demo/index.html +53 -0
- data/app/assets/components/iron-form-element-behavior/demo/simple-element.html +27 -0
- data/app/assets/components/iron-form-element-behavior/demo/simple-form.html +42 -0
- data/app/assets/components/iron-form-element-behavior/index.html +30 -0
- data/app/assets/components/iron-form-element-behavior/iron-form-element-behavior.html +50 -0
- data/app/assets/components/iron-icon/README.md +56 -0
- data/app/assets/components/iron-icon/bower.json +29 -0
- data/app/assets/components/iron-icon/demo/index.html +28 -0
- data/app/assets/components/iron-icon/demo/location.png +0 -0
- data/app/assets/components/iron-icon/hero.svg +19 -0
- data/app/assets/components/iron-icon/index.html +26 -0
- data/app/assets/components/iron-icon/iron-icon.html +187 -0
- data/app/assets/components/iron-icon/test/index.html +31 -0
- data/app/assets/components/iron-icon/test/iron-icon.html +120 -0
- data/app/assets/components/iron-input/README.md +16 -0
- data/app/assets/components/iron-input/bower.json +36 -0
- data/app/assets/components/iron-input/demo/index.html +87 -0
- data/app/assets/components/iron-input/hero.svg +19 -0
- data/app/assets/components/iron-input/index.html +30 -0
- data/app/assets/components/iron-input/iron-input.html +235 -0
- data/app/assets/components/iron-input/test/index.html +24 -0
- data/app/assets/components/iron-input/test/iron-input.html +139 -0
- data/app/assets/components/iron-input/test/letters-only.html +30 -0
- data/app/assets/components/iron-meta/README.md +46 -0
- data/app/assets/components/iron-meta/bower.json +28 -0
- data/app/assets/components/iron-meta/demo/index.html +45 -0
- data/app/assets/components/iron-meta/hero.svg +33 -0
- data/app/assets/components/iron-meta/index.html +27 -0
- data/app/assets/components/iron-meta/iron-meta.html +352 -0
- data/app/assets/components/iron-meta/test/basic.html +48 -0
- data/app/assets/components/iron-meta/test/index.html +30 -0
- data/app/assets/components/iron-meta/test/iron-meta.html +186 -0
- data/app/assets/components/iron-validatable-behavior/README.md +3 -0
- data/app/assets/components/iron-validatable-behavior/bower.json +35 -0
- data/app/assets/components/iron-validatable-behavior/demo/cats-only.html +46 -0
- data/app/assets/components/iron-validatable-behavior/demo/index.html +71 -0
- data/app/assets/components/iron-validatable-behavior/demo/validatable-input.html +46 -0
- data/app/assets/components/iron-validatable-behavior/index.html +30 -0
- data/app/assets/components/iron-validatable-behavior/iron-validatable-behavior.html +101 -0
- data/app/assets/components/iron-validatable-behavior/test/index.html +35 -0
- data/app/assets/components/iron-validatable-behavior/test/iron-validatable-behavior.html +52 -0
- data/app/assets/components/iron-validatable-behavior/test/test-validatable.html +28 -0
- data/app/assets/components/iron-validator-behavior/README.md +4 -0
- data/app/assets/components/iron-validator-behavior/bower.json +34 -0
- data/app/assets/components/iron-validator-behavior/demo/cats-only.html +46 -0
- data/app/assets/components/iron-validator-behavior/demo/index.html +144 -0
- data/app/assets/components/iron-validator-behavior/index.html +30 -0
- data/app/assets/components/iron-validator-behavior/iron-validator-behavior.html +61 -0
- data/app/assets/components/iron-validator-behavior/test/index.html +34 -0
- data/app/assets/components/iron-validator-behavior/test/iron-validator-behavior.html +47 -0
- data/app/assets/components/iron-validator-behavior/test/simple-validator.html +26 -0
- data/app/assets/components/paper-input/README.md +5 -0
- data/app/assets/components/paper-input/all-imports.html +12 -0
- data/app/assets/components/paper-input/bower.json +44 -0
- data/app/assets/components/paper-input/demo/index.html +96 -0
- data/app/assets/components/paper-input/demo/ssn-input.html +94 -0
- data/app/assets/components/paper-input/demo/ssn-validator.html +31 -0
- data/app/assets/components/paper-input/hero.svg +19 -0
- data/app/assets/components/paper-input/index.html +28 -0
- data/app/assets/components/paper-input/paper-input-addon-behavior.html +47 -0
- data/app/assets/components/paper-input/paper-input-behavior.html +317 -0
- data/app/assets/components/paper-input/paper-input-char-counter.html +95 -0
- data/app/assets/components/paper-input/paper-input-container.html +495 -0
- data/app/assets/components/paper-input/paper-input-error.html +99 -0
- data/app/assets/components/paper-input/paper-input.html +126 -0
- data/app/assets/components/paper-input/paper-textarea.html +106 -0
- data/app/assets/components/paper-input/test/index.html +28 -0
- data/app/assets/components/paper-input/test/letters-only.html +30 -0
- data/app/assets/components/paper-input/test/paper-input-char-counter.html +112 -0
- data/app/assets/components/paper-input/test/paper-input-container.html +237 -0
- data/app/assets/components/paper-input/test/paper-input-error.html +60 -0
- data/app/assets/components/paper-input/test/paper-input.html +213 -0
- data/app/assets/components/paper-input/test/paper-textarea.html +169 -0
- data/app/assets/components/paper-styles/README.md +3 -0
- data/app/assets/components/paper-styles/bower.json +27 -0
- data/app/assets/components/paper-styles/classes/global.html +96 -0
- data/app/assets/components/paper-styles/classes/shadow-layout.html +302 -0
- data/app/assets/components/paper-styles/classes/shadow.html +39 -0
- data/app/assets/components/paper-styles/classes/typography.html +171 -0
- data/app/assets/components/paper-styles/color.html +333 -0
- data/app/assets/components/paper-styles/default-theme.html +39 -0
- data/app/assets/components/paper-styles/demo-pages.html +72 -0
- data/app/assets/components/paper-styles/demo.css +25 -0
- data/app/assets/components/paper-styles/paper-styles-classes.html +14 -0
- data/app/assets/components/paper-styles/paper-styles.html +17 -0
- data/app/assets/components/paper-styles/shadow.html +61 -0
- data/app/assets/components/paper-styles/typography.html +240 -0
- data/app/assets/components/polymer/LICENSE.txt +27 -0
- data/app/assets/components/polymer/bower.json +26 -0
- data/app/assets/components/polymer/build.log +27 -0
- data/app/assets/components/polymer/polymer-micro.html +523 -0
- data/app/assets/components/polymer/polymer-mini.html +1368 -0
- data/app/assets/components/polymer/polymer.html +3768 -0
- data/app/assets/components/webcomponentsjs/CustomElements.js +956 -0
- data/app/assets/components/webcomponentsjs/CustomElements.min.js +11 -0
- data/app/assets/components/webcomponentsjs/HTMLImports.js +1078 -0
- data/app/assets/components/webcomponentsjs/HTMLImports.min.js +11 -0
- data/app/assets/components/webcomponentsjs/MutationObserver.js +344 -0
- data/app/assets/components/webcomponentsjs/MutationObserver.min.js +11 -0
- data/app/assets/components/webcomponentsjs/README.md +125 -0
- data/app/assets/components/webcomponentsjs/ShadowDOM.js +4414 -0
- data/app/assets/components/webcomponentsjs/ShadowDOM.min.js +15 -0
- data/app/assets/components/webcomponentsjs/bower.json +14 -0
- data/app/assets/components/webcomponentsjs/build.log +33 -0
- data/app/assets/components/webcomponentsjs/package.json +31 -0
- data/app/assets/components/webcomponentsjs/webcomponents-lite.js +2300 -0
- data/app/assets/components/webcomponentsjs/webcomponents-lite.min.js +13 -0
- data/app/assets/components/webcomponentsjs/webcomponents.js +7112 -0
- data/app/assets/components/webcomponentsjs/webcomponents.min.js +15 -0
- data/lib/polymer-gold-rails.rb +2 -0
- data/lib/polymer-gold-rails/enigne.rb +4 -0
- data/lib/polymer-gold-rails/version.rb +3 -0
- metadata +312 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
4
|
+
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
5
|
+
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
6
|
+
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
7
|
+
* Code distributed by Google as part of the polymer project is also
|
8
|
+
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
9
|
+
*/
|
10
|
+
// @version 0.7.3
|
11
|
+
"undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now()%1e9,r=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};r.prototype={set:function(t,r){var n=t[this.name];return n&&n[0]===t?n[1]=r:e(t,this.name,{value:[t,r],writable:!0}),this},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){var t=e[this.name];return t&&t[0]===e?(t[0]=t[1]=void 0,!0):!1},has:function(e){var t=e[this.name];return t?t[0]===e:!1}},window.WeakMap=r}(),function(e){function t(e){E.push(e),_||(_=!0,f(n))}function r(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(e)||e}function n(){_=!1;var e=E;E=[],e.sort(function(e,t){return e.uid_-t.uid_});var t=!1;e.forEach(function(e){var r=e.takeRecords();o(e),r.length&&(e.callback_(r,e),t=!0)}),t&&n()}function o(e){e.nodes_.forEach(function(t){var r=v.get(t);r&&r.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}function i(e,t){for(var r=e;r;r=r.parentNode){var n=v.get(r);if(n)for(var o=0;o<n.length;o++){var i=n[o],a=i.options;if(r===e||a.subtree){var s=t(a);s&&i.enqueue(s)}}}}function a(e){this.callback_=e,this.nodes_=[],this.records_=[],this.uid_=++w}function s(e,t){this.type=e,this.target=t,this.addedNodes=[],this.removedNodes=[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function d(e){var t=new s(e.type,e.target);return t.addedNodes=e.addedNodes.slice(),t.removedNodes=e.removedNodes.slice(),t.previousSibling=e.previousSibling,t.nextSibling=e.nextSibling,t.attributeName=e.attributeName,t.attributeNamespace=e.attributeNamespace,t.oldValue=e.oldValue,t}function c(e,t){return L=new s(e,t)}function u(e){return y?y:(y=d(L),y.oldValue=e,y)}function l(){L=y=void 0}function h(e){return e===y||e===L}function m(e,t){return e===t?e:y&&h(e)?y:null}function p(e,t,r){this.observer=e,this.target=t,this.options=r,this.transientObservedNodes=[]}var f,v=new WeakMap;if(/Trident|Edge/.test(navigator.userAgent))f=setTimeout;else if(window.setImmediate)f=window.setImmediate;else{var b=[],g=String(Math.random());window.addEventListener("message",function(e){if(e.data===g){var t=b;b=[],t.forEach(function(e){e()})}}),f=function(e){b.push(e),window.postMessage(g,"*")}}var _=!1,E=[],w=0;a.prototype={observe:function(e,t){if(e=r(e),!t.childList&&!t.attributes&&!t.characterData||t.attributeOldValue&&!t.attributes||t.attributeFilter&&t.attributeFilter.length&&!t.attributes||t.characterDataOldValue&&!t.characterData)throw new SyntaxError;var n=v.get(e);n||v.set(e,n=[]);for(var o,i=0;i<n.length;i++)if(n[i].observer===this){o=n[i],o.removeListeners(),o.options=t;break}o||(o=new p(this,e,t),n.push(o),this.nodes_.push(e)),o.addListeners()},disconnect:function(){this.nodes_.forEach(function(e){for(var t=v.get(e),r=0;r<t.length;r++){var n=t[r];if(n.observer===this){n.removeListeners(),t.splice(r,1);break}}},this),this.records_=[]},takeRecords:function(){var e=this.records_;return this.records_=[],e}};var L,y;p.prototype={enqueue:function(e){var r=this.observer.records_,n=r.length;if(r.length>0){var o=r[n-1],i=m(o,e);if(i)return void(r[n-1]=i)}else t(this.observer);r[n]=e},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListener("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",this,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(e){if(e!==this.target){this.addListeners_(e),this.transientObservedNodes.push(e);var t=v.get(e);t||v.set(e,t=[]),t.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e.forEach(function(e){this.removeListeners_(e);for(var t=v.get(e),r=0;r<t.length;r++)if(t[r]===this){t.splice(r,1);break}},this)},handleEvent:function(e){switch(e.stopImmediatePropagation(),e.type){case"DOMAttrModified":var t=e.attrName,r=e.relatedNode.namespaceURI,n=e.target,o=new c("attributes",n);o.attributeName=t,o.attributeNamespace=r;var a=e.attrChange===MutationEvent.ADDITION?null:e.prevValue;i(n,function(e){return!e.attributes||e.attributeFilter&&e.attributeFilter.length&&-1===e.attributeFilter.indexOf(t)&&-1===e.attributeFilter.indexOf(r)?void 0:e.attributeOldValue?u(a):o});break;case"DOMCharacterDataModified":var n=e.target,o=c("characterData",n),a=e.prevValue;i(n,function(e){return e.characterData?e.characterDataOldValue?u(a):o:void 0});break;case"DOMNodeRemoved":this.addTransientObserver(e.target);case"DOMNodeInserted":var s,d,h=e.target;"DOMNodeInserted"===e.type?(s=[h],d=[]):(s=[],d=[h]);var m=h.previousSibling,p=h.nextSibling,o=c("childList",e.target.parentNode);o.addedNodes=s,o.removedNodes=d,o.previousSibling=m,o.nextSibling=p,i(e.relatedNode,function(e){return e.childList?o:void 0})}l()}},e.JsMutationObserver=a,e.MutationObserver||(e.MutationObserver=a)}(this),window.HTMLImports=window.HTMLImports||{flags:{}},function(e){function t(e,t){t=t||p,n(function(){i(e,t)},t)}function r(e){return"complete"===e.readyState||e.readyState===b}function n(e,t){if(r(t))e&&e();else{var o=function(){("complete"===t.readyState||t.readyState===b)&&(t.removeEventListener(g,o),n(e,t))};t.addEventListener(g,o)}}function o(e){e.target.__loaded=!0}function i(e,t){function r(){d==c&&e&&e({allImports:s,loadedImports:u,errorImports:l})}function n(e){o(e),u.push(this),d++,r()}function i(e){l.push(this),d++,r()}var s=t.querySelectorAll("link[rel=import]"),d=0,c=s.length,u=[],l=[];if(c)for(var h,m=0;c>m&&(h=s[m]);m++)a(h)?(d++,r()):(h.addEventListener("load",n),h.addEventListener("error",i));else r()}function a(e){return l?e.__loaded||e["import"]&&"loading"!==e["import"].readyState:e.__importParsed}function s(e){for(var t,r=0,n=e.length;n>r&&(t=e[r]);r++)d(t)&&c(t)}function d(e){return"link"===e.localName&&"import"===e.rel}function c(e){var t=e["import"];t?o({target:e}):(e.addEventListener("load",o),e.addEventListener("error",o))}var u="import",l=Boolean(u in document.createElement("link")),h=Boolean(window.ShadowDOMPolyfill),m=function(e){return h?ShadowDOMPolyfill.wrapIfNeeded(e):e},p=m(document),f={get:function(){var e=HTMLImports.currentScript||document.currentScript||("complete"!==document.readyState?document.scripts[document.scripts.length-1]:null);return m(e)},configurable:!0};Object.defineProperty(document,"_currentScript",f),Object.defineProperty(p,"_currentScript",f);var v=/Trident|Edge/.test(navigator.userAgent),b=v?"complete":"interactive",g="readystatechange";l&&(new MutationObserver(function(e){for(var t,r=0,n=e.length;n>r&&(t=e[r]);r++)t.addedNodes&&s(t.addedNodes)}).observe(document.head,{childList:!0}),function(){if("loading"===document.readyState)for(var e,t=document.querySelectorAll("link[rel=import]"),r=0,n=t.length;n>r&&(e=t[r]);r++)c(e)}()),t(function(e){HTMLImports.ready=!0,HTMLImports.readyTime=(new Date).getTime();var t=p.createEvent("CustomEvent");t.initCustomEvent("HTMLImportsLoaded",!0,!0,e),p.dispatchEvent(t)}),e.IMPORT_LINK_TYPE=u,e.useNative=l,e.rootDocument=p,e.whenReady=t,e.isIE=v}(window.HTMLImports),function(e){var t=[],r=function(e){t.push(e)},n=function(){t.forEach(function(t){t(e)})};e.addModule=r,e.initializeModules=n}(window.HTMLImports),window.HTMLImports.addModule(function(e){var t=/(url\()([^)]*)(\))/g,r=/(@import[\s]+(?!url\())([^;]*)(;)/g,n={resolveUrlsInStyle:function(e,t){var r=e.ownerDocument,n=r.createElement("a");return e.textContent=this.resolveUrlsInCssText(e.textContent,t,n),e},resolveUrlsInCssText:function(e,n,o){var i=this.replaceUrls(e,o,n,t);return i=this.replaceUrls(i,o,n,r)},replaceUrls:function(e,t,r,n){return e.replace(n,function(e,n,o,i){var a=o.replace(/["']/g,"");return r&&(a=new URL(a,r).href),t.href=a,a=t.href,n+"'"+a+"'"+i})}};e.path=n}),window.HTMLImports.addModule(function(e){var t={async:!0,ok:function(e){return e.status>=200&&e.status<300||304===e.status||0===e.status},load:function(r,n,o){var i=new XMLHttpRequest;return(e.flags.debug||e.flags.bust)&&(r+="?"+Math.random()),i.open("GET",r,t.async),i.addEventListener("readystatechange",function(e){if(4===i.readyState){var r=i.getResponseHeader("Location"),a=null;if(r)var a="/"===r.substr(0,1)?location.origin+r:r;n.call(o,!t.ok(i)&&i,i.response||i.responseText,a)}}),i.send(),i},loadDocument:function(e,t,r){this.load(e,t,r).responseType="document"}};e.xhr=t}),window.HTMLImports.addModule(function(e){var t=e.xhr,r=e.flags,n=function(e,t){this.cache={},this.onload=e,this.oncomplete=t,this.inflight=0,this.pending={}};n.prototype={addNodes:function(e){this.inflight+=e.length;for(var t,r=0,n=e.length;n>r&&(t=e[r]);r++)this.require(t);this.checkDone()},addNode:function(e){this.inflight++,this.require(e),this.checkDone()},require:function(e){var t=e.src||e.href;e.__nodeUrl=t,this.dedupe(t,e)||this.fetch(t,e)},dedupe:function(e,t){if(this.pending[e])return this.pending[e].push(t),!0;return this.cache[e]?(this.onload(e,t,this.cache[e]),this.tail(),!0):(this.pending[e]=[t],!1)},fetch:function(e,n){if(r.load&&console.log("fetch",e,n),e)if(e.match(/^data:/)){var o=e.split(","),i=o[0],a=o[1];a=i.indexOf(";base64")>-1?atob(a):decodeURIComponent(a),setTimeout(function(){this.receive(e,n,null,a)}.bind(this),0)}else{var s=function(t,r,o){this.receive(e,n,t,r,o)}.bind(this);t.load(e,s)}else setTimeout(function(){this.receive(e,n,{error:"href must be specified"},null)}.bind(this),0)},receive:function(e,t,r,n,o){this.cache[e]=n;for(var i,a=this.pending[e],s=0,d=a.length;d>s&&(i=a[s]);s++)this.onload(e,i,n,r,o),this.tail();this.pending[e]=null},tail:function(){--this.inflight,this.checkDone()},checkDone:function(){this.inflight||this.oncomplete()}},e.Loader=n}),window.HTMLImports.addModule(function(e){var t=function(e){this.addCallback=e,this.mo=new MutationObserver(this.handler.bind(this))};t.prototype={handler:function(e){for(var t,r=0,n=e.length;n>r&&(t=e[r]);r++)"childList"===t.type&&t.addedNodes.length&&this.addedNodes(t.addedNodes)},addedNodes:function(e){this.addCallback&&this.addCallback(e);for(var t,r=0,n=e.length;n>r&&(t=e[r]);r++)t.children&&t.children.length&&this.addedNodes(t.children)},observe:function(e){this.mo.observe(e,{childList:!0,subtree:!0})}},e.Observer=t}),window.HTMLImports.addModule(function(e){function t(e){return"link"===e.localName&&e.rel===u}function r(e){var t=n(e);return"data:text/javascript;charset=utf-8,"+encodeURIComponent(t)}function n(e){return e.textContent+o(e)}function o(e){var t=e.ownerDocument;t.__importedScripts=t.__importedScripts||0;var r=e.ownerDocument.baseURI,n=t.__importedScripts?"-"+t.__importedScripts:"";return t.__importedScripts++,"\n//# sourceURL="+r+n+".js\n"}function i(e){var t=e.ownerDocument.createElement("style");return t.textContent=e.textContent,a.resolveUrlsInStyle(t),t}var a=e.path,s=e.rootDocument,d=e.flags,c=e.isIE,u=e.IMPORT_LINK_TYPE,l="link[rel="+u+"]",h={documentSelectors:l,importsSelectors:[l,"link[rel=stylesheet]","style","script:not([type])",'script[type="application/javascript"]','script[type="text/javascript"]'].join(","),map:{link:"parseLink",script:"parseScript",style:"parseStyle"},dynamicElements:[],parseNext:function(){var e=this.nextToParse();e&&this.parse(e)},parse:function(e){if(this.isParsed(e))return void(d.parse&&console.log("[%s] is already parsed",e.localName));var t=this[this.map[e.localName]];t&&(this.markParsing(e),t.call(this,e))},parseDynamic:function(e,t){this.dynamicElements.push(e),t||this.parseNext()},markParsing:function(e){d.parse&&console.log("parsing",e),this.parsingElement=e},markParsingComplete:function(e){e.__importParsed=!0,this.markDynamicParsingComplete(e),e.__importElement&&(e.__importElement.__importParsed=!0,this.markDynamicParsingComplete(e.__importElement)),this.parsingElement=null,d.parse&&console.log("completed",e)},markDynamicParsingComplete:function(e){var t=this.dynamicElements.indexOf(e);t>=0&&this.dynamicElements.splice(t,1)},parseImport:function(e){if(HTMLImports.__importsParsingHook&&HTMLImports.__importsParsingHook(e),e["import"]&&(e["import"].__importParsed=!0),this.markParsingComplete(e),e.dispatchEvent(e.__resource&&!e.__error?new CustomEvent("load",{bubbles:!1}):new CustomEvent("error",{bubbles:!1})),e.__pending)for(var t;e.__pending.length;)t=e.__pending.shift(),t&&t({target:e});this.parseNext()},parseLink:function(e){t(e)?this.parseImport(e):(e.href=e.href,this.parseGeneric(e))},parseStyle:function(e){var t=e;e=i(e),t.__appliedElement=e,e.__importElement=t,this.parseGeneric(e)},parseGeneric:function(e){this.trackElement(e),this.addElementToDocument(e)},rootImportForElement:function(e){for(var t=e;t.ownerDocument.__importLink;)t=t.ownerDocument.__importLink;return t},addElementToDocument:function(e){var t=this.rootImportForElement(e.__importElement||e);t.parentNode.insertBefore(e,t)},trackElement:function(e,t){var r=this,n=function(n){t&&t(n),r.markParsingComplete(e),r.parseNext()};if(e.addEventListener("load",n),e.addEventListener("error",n),c&&"style"===e.localName){var o=!1;if(-1==e.textContent.indexOf("@import"))o=!0;else if(e.sheet){o=!0;for(var i,a=e.sheet.cssRules,s=a?a.length:0,d=0;s>d&&(i=a[d]);d++)i.type===CSSRule.IMPORT_RULE&&(o=o&&Boolean(i.styleSheet))}o&&setTimeout(function(){e.dispatchEvent(new CustomEvent("load",{bubbles:!1}))})}},parseScript:function(t){var n=document.createElement("script");n.__importElement=t,n.src=t.src?t.src:r(t),e.currentScript=t,this.trackElement(n,function(t){n.parentNode.removeChild(n),e.currentScript=null}),this.addElementToDocument(n)},nextToParse:function(){return this._mayParse=[],!this.parsingElement&&(this.nextToParseInDoc(s)||this.nextToParseDynamic())},nextToParseInDoc:function(e,r){if(e&&this._mayParse.indexOf(e)<0){this._mayParse.push(e);for(var n,o=e.querySelectorAll(this.parseSelectorsForNode(e)),i=0,a=o.length;a>i&&(n=o[i]);i++)if(!this.isParsed(n))return this.hasResource(n)?t(n)?this.nextToParseInDoc(n["import"],n):n:void 0}return r},nextToParseDynamic:function(){return this.dynamicElements[0]},parseSelectorsForNode:function(e){var t=e.ownerDocument||e;return t===s?this.documentSelectors:this.importsSelectors},isParsed:function(e){return e.__importParsed},needsDynamicParsing:function(e){return this.dynamicElements.indexOf(e)>=0},hasResource:function(e){return t(e)&&void 0===e["import"]?!1:!0}};e.parser=h,e.IMPORT_SELECTOR=l}),window.HTMLImports.addModule(function(e){function t(e){return r(e,a)}function r(e,t){return"link"===e.localName&&e.getAttribute("rel")===t}function n(e){return!!Object.getOwnPropertyDescriptor(e,"baseURI")}function o(e,t){var r=document.implementation.createHTMLDocument(a);r._URL=t;var o=r.createElement("base");o.setAttribute("href",t),r.baseURI||n(r)||Object.defineProperty(r,"baseURI",{value:t});var i=r.createElement("meta");return i.setAttribute("charset","utf-8"),r.head.appendChild(i),r.head.appendChild(o),r.body.innerHTML=e,window.HTMLTemplateElement&&HTMLTemplateElement.bootstrap&&HTMLTemplateElement.bootstrap(r),r}var i=e.flags,a=e.IMPORT_LINK_TYPE,s=e.IMPORT_SELECTOR,d=e.rootDocument,c=e.Loader,u=e.Observer,l=e.parser,h={documents:{},documentPreloadSelectors:s,importsPreloadSelectors:[s].join(","),loadNode:function(e){m.addNode(e)},loadSubtree:function(e){var t=this.marshalNodes(e);m.addNodes(t)},marshalNodes:function(e){return e.querySelectorAll(this.loadSelectorsForNode(e))},loadSelectorsForNode:function(e){var t=e.ownerDocument||e;return t===d?this.documentPreloadSelectors:this.importsPreloadSelectors},loaded:function(e,r,n,a,s){if(i.load&&console.log("loaded",e,r),r.__resource=n,r.__error=a,t(r)){var d=this.documents[e];void 0===d&&(d=a?null:o(n,s||e),d&&(d.__importLink=r,this.bootDocument(d)),this.documents[e]=d),r["import"]=d}l.parseNext()},bootDocument:function(e){this.loadSubtree(e),this.observer.observe(e),l.parseNext()},loadedAll:function(){l.parseNext()}},m=new c(h.loaded.bind(h),h.loadedAll.bind(h));if(h.observer=new u,!document.baseURI){var p={get:function(){var e=document.querySelector("base");return e?e.href:window.location.href},configurable:!0};Object.defineProperty(document,"baseURI",p),Object.defineProperty(d,"baseURI",p)}e.importer=h,e.importLoader=m}),window.HTMLImports.addModule(function(e){var t=e.parser,r=e.importer,n={added:function(e){for(var n,o,i,a,s=0,d=e.length;d>s&&(a=e[s]);s++)n||(n=a.ownerDocument,o=t.isParsed(n)),i=this.shouldLoadNode(a),i&&r.loadNode(a),this.shouldParseNode(a)&&o&&t.parseDynamic(a,i)},shouldLoadNode:function(e){return 1===e.nodeType&&o.call(e,r.loadSelectorsForNode(e))},shouldParseNode:function(e){return 1===e.nodeType&&o.call(e,t.parseSelectorsForNode(e))}};r.observer.addCallback=n.added.bind(n);var o=HTMLElement.prototype.matches||HTMLElement.prototype.matchesSelector||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector}),function(e){function t(){HTMLImports.importer.bootDocument(o)}var r=e.initializeModules,n=e.isIE;if(!e.useNative){n&&"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(e,t){t=t||{};var r=document.createEvent("CustomEvent");return r.initCustomEvent(e,Boolean(t.bubbles),Boolean(t.cancelable),t.detail),r},window.CustomEvent.prototype=window.Event.prototype),r();var o=e.rootDocument;"complete"===document.readyState||"interactive"===document.readyState&&!window.attachEvent?t():document.addEventListener("DOMContentLoaded",t)}}(window.HTMLImports);
|
@@ -0,0 +1,344 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
4
|
+
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
5
|
+
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
6
|
+
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
7
|
+
* Code distributed by Google as part of the polymer project is also
|
8
|
+
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
9
|
+
*/
|
10
|
+
// @version 0.7.3
|
11
|
+
if (typeof WeakMap === "undefined") {
|
12
|
+
(function() {
|
13
|
+
var defineProperty = Object.defineProperty;
|
14
|
+
var counter = Date.now() % 1e9;
|
15
|
+
var WeakMap = function() {
|
16
|
+
this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__");
|
17
|
+
};
|
18
|
+
WeakMap.prototype = {
|
19
|
+
set: function(key, value) {
|
20
|
+
var entry = key[this.name];
|
21
|
+
if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, {
|
22
|
+
value: [ key, value ],
|
23
|
+
writable: true
|
24
|
+
});
|
25
|
+
return this;
|
26
|
+
},
|
27
|
+
get: function(key) {
|
28
|
+
var entry;
|
29
|
+
return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined;
|
30
|
+
},
|
31
|
+
"delete": function(key) {
|
32
|
+
var entry = key[this.name];
|
33
|
+
if (!entry || entry[0] !== key) return false;
|
34
|
+
entry[0] = entry[1] = undefined;
|
35
|
+
return true;
|
36
|
+
},
|
37
|
+
has: function(key) {
|
38
|
+
var entry = key[this.name];
|
39
|
+
if (!entry) return false;
|
40
|
+
return entry[0] === key;
|
41
|
+
}
|
42
|
+
};
|
43
|
+
window.WeakMap = WeakMap;
|
44
|
+
})();
|
45
|
+
}
|
46
|
+
|
47
|
+
(function(global) {
|
48
|
+
var registrationsTable = new WeakMap();
|
49
|
+
var setImmediate;
|
50
|
+
if (/Trident|Edge/.test(navigator.userAgent)) {
|
51
|
+
setImmediate = setTimeout;
|
52
|
+
} else if (window.setImmediate) {
|
53
|
+
setImmediate = window.setImmediate;
|
54
|
+
} else {
|
55
|
+
var setImmediateQueue = [];
|
56
|
+
var sentinel = String(Math.random());
|
57
|
+
window.addEventListener("message", function(e) {
|
58
|
+
if (e.data === sentinel) {
|
59
|
+
var queue = setImmediateQueue;
|
60
|
+
setImmediateQueue = [];
|
61
|
+
queue.forEach(function(func) {
|
62
|
+
func();
|
63
|
+
});
|
64
|
+
}
|
65
|
+
});
|
66
|
+
setImmediate = function(func) {
|
67
|
+
setImmediateQueue.push(func);
|
68
|
+
window.postMessage(sentinel, "*");
|
69
|
+
};
|
70
|
+
}
|
71
|
+
var isScheduled = false;
|
72
|
+
var scheduledObservers = [];
|
73
|
+
function scheduleCallback(observer) {
|
74
|
+
scheduledObservers.push(observer);
|
75
|
+
if (!isScheduled) {
|
76
|
+
isScheduled = true;
|
77
|
+
setImmediate(dispatchCallbacks);
|
78
|
+
}
|
79
|
+
}
|
80
|
+
function wrapIfNeeded(node) {
|
81
|
+
return window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(node) || node;
|
82
|
+
}
|
83
|
+
function dispatchCallbacks() {
|
84
|
+
isScheduled = false;
|
85
|
+
var observers = scheduledObservers;
|
86
|
+
scheduledObservers = [];
|
87
|
+
observers.sort(function(o1, o2) {
|
88
|
+
return o1.uid_ - o2.uid_;
|
89
|
+
});
|
90
|
+
var anyNonEmpty = false;
|
91
|
+
observers.forEach(function(observer) {
|
92
|
+
var queue = observer.takeRecords();
|
93
|
+
removeTransientObserversFor(observer);
|
94
|
+
if (queue.length) {
|
95
|
+
observer.callback_(queue, observer);
|
96
|
+
anyNonEmpty = true;
|
97
|
+
}
|
98
|
+
});
|
99
|
+
if (anyNonEmpty) dispatchCallbacks();
|
100
|
+
}
|
101
|
+
function removeTransientObserversFor(observer) {
|
102
|
+
observer.nodes_.forEach(function(node) {
|
103
|
+
var registrations = registrationsTable.get(node);
|
104
|
+
if (!registrations) return;
|
105
|
+
registrations.forEach(function(registration) {
|
106
|
+
if (registration.observer === observer) registration.removeTransientObservers();
|
107
|
+
});
|
108
|
+
});
|
109
|
+
}
|
110
|
+
function forEachAncestorAndObserverEnqueueRecord(target, callback) {
|
111
|
+
for (var node = target; node; node = node.parentNode) {
|
112
|
+
var registrations = registrationsTable.get(node);
|
113
|
+
if (registrations) {
|
114
|
+
for (var j = 0; j < registrations.length; j++) {
|
115
|
+
var registration = registrations[j];
|
116
|
+
var options = registration.options;
|
117
|
+
if (node !== target && !options.subtree) continue;
|
118
|
+
var record = callback(options);
|
119
|
+
if (record) registration.enqueue(record);
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
124
|
+
var uidCounter = 0;
|
125
|
+
function JsMutationObserver(callback) {
|
126
|
+
this.callback_ = callback;
|
127
|
+
this.nodes_ = [];
|
128
|
+
this.records_ = [];
|
129
|
+
this.uid_ = ++uidCounter;
|
130
|
+
}
|
131
|
+
JsMutationObserver.prototype = {
|
132
|
+
observe: function(target, options) {
|
133
|
+
target = wrapIfNeeded(target);
|
134
|
+
if (!options.childList && !options.attributes && !options.characterData || options.attributeOldValue && !options.attributes || options.attributeFilter && options.attributeFilter.length && !options.attributes || options.characterDataOldValue && !options.characterData) {
|
135
|
+
throw new SyntaxError();
|
136
|
+
}
|
137
|
+
var registrations = registrationsTable.get(target);
|
138
|
+
if (!registrations) registrationsTable.set(target, registrations = []);
|
139
|
+
var registration;
|
140
|
+
for (var i = 0; i < registrations.length; i++) {
|
141
|
+
if (registrations[i].observer === this) {
|
142
|
+
registration = registrations[i];
|
143
|
+
registration.removeListeners();
|
144
|
+
registration.options = options;
|
145
|
+
break;
|
146
|
+
}
|
147
|
+
}
|
148
|
+
if (!registration) {
|
149
|
+
registration = new Registration(this, target, options);
|
150
|
+
registrations.push(registration);
|
151
|
+
this.nodes_.push(target);
|
152
|
+
}
|
153
|
+
registration.addListeners();
|
154
|
+
},
|
155
|
+
disconnect: function() {
|
156
|
+
this.nodes_.forEach(function(node) {
|
157
|
+
var registrations = registrationsTable.get(node);
|
158
|
+
for (var i = 0; i < registrations.length; i++) {
|
159
|
+
var registration = registrations[i];
|
160
|
+
if (registration.observer === this) {
|
161
|
+
registration.removeListeners();
|
162
|
+
registrations.splice(i, 1);
|
163
|
+
break;
|
164
|
+
}
|
165
|
+
}
|
166
|
+
}, this);
|
167
|
+
this.records_ = [];
|
168
|
+
},
|
169
|
+
takeRecords: function() {
|
170
|
+
var copyOfRecords = this.records_;
|
171
|
+
this.records_ = [];
|
172
|
+
return copyOfRecords;
|
173
|
+
}
|
174
|
+
};
|
175
|
+
function MutationRecord(type, target) {
|
176
|
+
this.type = type;
|
177
|
+
this.target = target;
|
178
|
+
this.addedNodes = [];
|
179
|
+
this.removedNodes = [];
|
180
|
+
this.previousSibling = null;
|
181
|
+
this.nextSibling = null;
|
182
|
+
this.attributeName = null;
|
183
|
+
this.attributeNamespace = null;
|
184
|
+
this.oldValue = null;
|
185
|
+
}
|
186
|
+
function copyMutationRecord(original) {
|
187
|
+
var record = new MutationRecord(original.type, original.target);
|
188
|
+
record.addedNodes = original.addedNodes.slice();
|
189
|
+
record.removedNodes = original.removedNodes.slice();
|
190
|
+
record.previousSibling = original.previousSibling;
|
191
|
+
record.nextSibling = original.nextSibling;
|
192
|
+
record.attributeName = original.attributeName;
|
193
|
+
record.attributeNamespace = original.attributeNamespace;
|
194
|
+
record.oldValue = original.oldValue;
|
195
|
+
return record;
|
196
|
+
}
|
197
|
+
var currentRecord, recordWithOldValue;
|
198
|
+
function getRecord(type, target) {
|
199
|
+
return currentRecord = new MutationRecord(type, target);
|
200
|
+
}
|
201
|
+
function getRecordWithOldValue(oldValue) {
|
202
|
+
if (recordWithOldValue) return recordWithOldValue;
|
203
|
+
recordWithOldValue = copyMutationRecord(currentRecord);
|
204
|
+
recordWithOldValue.oldValue = oldValue;
|
205
|
+
return recordWithOldValue;
|
206
|
+
}
|
207
|
+
function clearRecords() {
|
208
|
+
currentRecord = recordWithOldValue = undefined;
|
209
|
+
}
|
210
|
+
function recordRepresentsCurrentMutation(record) {
|
211
|
+
return record === recordWithOldValue || record === currentRecord;
|
212
|
+
}
|
213
|
+
function selectRecord(lastRecord, newRecord) {
|
214
|
+
if (lastRecord === newRecord) return lastRecord;
|
215
|
+
if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord)) return recordWithOldValue;
|
216
|
+
return null;
|
217
|
+
}
|
218
|
+
function Registration(observer, target, options) {
|
219
|
+
this.observer = observer;
|
220
|
+
this.target = target;
|
221
|
+
this.options = options;
|
222
|
+
this.transientObservedNodes = [];
|
223
|
+
}
|
224
|
+
Registration.prototype = {
|
225
|
+
enqueue: function(record) {
|
226
|
+
var records = this.observer.records_;
|
227
|
+
var length = records.length;
|
228
|
+
if (records.length > 0) {
|
229
|
+
var lastRecord = records[length - 1];
|
230
|
+
var recordToReplaceLast = selectRecord(lastRecord, record);
|
231
|
+
if (recordToReplaceLast) {
|
232
|
+
records[length - 1] = recordToReplaceLast;
|
233
|
+
return;
|
234
|
+
}
|
235
|
+
} else {
|
236
|
+
scheduleCallback(this.observer);
|
237
|
+
}
|
238
|
+
records[length] = record;
|
239
|
+
},
|
240
|
+
addListeners: function() {
|
241
|
+
this.addListeners_(this.target);
|
242
|
+
},
|
243
|
+
addListeners_: function(node) {
|
244
|
+
var options = this.options;
|
245
|
+
if (options.attributes) node.addEventListener("DOMAttrModified", this, true);
|
246
|
+
if (options.characterData) node.addEventListener("DOMCharacterDataModified", this, true);
|
247
|
+
if (options.childList) node.addEventListener("DOMNodeInserted", this, true);
|
248
|
+
if (options.childList || options.subtree) node.addEventListener("DOMNodeRemoved", this, true);
|
249
|
+
},
|
250
|
+
removeListeners: function() {
|
251
|
+
this.removeListeners_(this.target);
|
252
|
+
},
|
253
|
+
removeListeners_: function(node) {
|
254
|
+
var options = this.options;
|
255
|
+
if (options.attributes) node.removeEventListener("DOMAttrModified", this, true);
|
256
|
+
if (options.characterData) node.removeEventListener("DOMCharacterDataModified", this, true);
|
257
|
+
if (options.childList) node.removeEventListener("DOMNodeInserted", this, true);
|
258
|
+
if (options.childList || options.subtree) node.removeEventListener("DOMNodeRemoved", this, true);
|
259
|
+
},
|
260
|
+
addTransientObserver: function(node) {
|
261
|
+
if (node === this.target) return;
|
262
|
+
this.addListeners_(node);
|
263
|
+
this.transientObservedNodes.push(node);
|
264
|
+
var registrations = registrationsTable.get(node);
|
265
|
+
if (!registrations) registrationsTable.set(node, registrations = []);
|
266
|
+
registrations.push(this);
|
267
|
+
},
|
268
|
+
removeTransientObservers: function() {
|
269
|
+
var transientObservedNodes = this.transientObservedNodes;
|
270
|
+
this.transientObservedNodes = [];
|
271
|
+
transientObservedNodes.forEach(function(node) {
|
272
|
+
this.removeListeners_(node);
|
273
|
+
var registrations = registrationsTable.get(node);
|
274
|
+
for (var i = 0; i < registrations.length; i++) {
|
275
|
+
if (registrations[i] === this) {
|
276
|
+
registrations.splice(i, 1);
|
277
|
+
break;
|
278
|
+
}
|
279
|
+
}
|
280
|
+
}, this);
|
281
|
+
},
|
282
|
+
handleEvent: function(e) {
|
283
|
+
e.stopImmediatePropagation();
|
284
|
+
switch (e.type) {
|
285
|
+
case "DOMAttrModified":
|
286
|
+
var name = e.attrName;
|
287
|
+
var namespace = e.relatedNode.namespaceURI;
|
288
|
+
var target = e.target;
|
289
|
+
var record = new getRecord("attributes", target);
|
290
|
+
record.attributeName = name;
|
291
|
+
record.attributeNamespace = namespace;
|
292
|
+
var oldValue = e.attrChange === MutationEvent.ADDITION ? null : e.prevValue;
|
293
|
+
forEachAncestorAndObserverEnqueueRecord(target, function(options) {
|
294
|
+
if (!options.attributes) return;
|
295
|
+
if (options.attributeFilter && options.attributeFilter.length && options.attributeFilter.indexOf(name) === -1 && options.attributeFilter.indexOf(namespace) === -1) {
|
296
|
+
return;
|
297
|
+
}
|
298
|
+
if (options.attributeOldValue) return getRecordWithOldValue(oldValue);
|
299
|
+
return record;
|
300
|
+
});
|
301
|
+
break;
|
302
|
+
|
303
|
+
case "DOMCharacterDataModified":
|
304
|
+
var target = e.target;
|
305
|
+
var record = getRecord("characterData", target);
|
306
|
+
var oldValue = e.prevValue;
|
307
|
+
forEachAncestorAndObserverEnqueueRecord(target, function(options) {
|
308
|
+
if (!options.characterData) return;
|
309
|
+
if (options.characterDataOldValue) return getRecordWithOldValue(oldValue);
|
310
|
+
return record;
|
311
|
+
});
|
312
|
+
break;
|
313
|
+
|
314
|
+
case "DOMNodeRemoved":
|
315
|
+
this.addTransientObserver(e.target);
|
316
|
+
|
317
|
+
case "DOMNodeInserted":
|
318
|
+
var changedNode = e.target;
|
319
|
+
var addedNodes, removedNodes;
|
320
|
+
if (e.type === "DOMNodeInserted") {
|
321
|
+
addedNodes = [ changedNode ];
|
322
|
+
removedNodes = [];
|
323
|
+
} else {
|
324
|
+
addedNodes = [];
|
325
|
+
removedNodes = [ changedNode ];
|
326
|
+
}
|
327
|
+
var previousSibling = changedNode.previousSibling;
|
328
|
+
var nextSibling = changedNode.nextSibling;
|
329
|
+
var record = getRecord("childList", e.target.parentNode);
|
330
|
+
record.addedNodes = addedNodes;
|
331
|
+
record.removedNodes = removedNodes;
|
332
|
+
record.previousSibling = previousSibling;
|
333
|
+
record.nextSibling = nextSibling;
|
334
|
+
forEachAncestorAndObserverEnqueueRecord(e.relatedNode, function(options) {
|
335
|
+
if (!options.childList) return;
|
336
|
+
return record;
|
337
|
+
});
|
338
|
+
}
|
339
|
+
clearRecords();
|
340
|
+
}
|
341
|
+
};
|
342
|
+
global.JsMutationObserver = JsMutationObserver;
|
343
|
+
if (!global.MutationObserver) global.MutationObserver = JsMutationObserver;
|
344
|
+
})(this);
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
4
|
+
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
5
|
+
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
6
|
+
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
7
|
+
* Code distributed by Google as part of the polymer project is also
|
8
|
+
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
9
|
+
*/
|
10
|
+
// @version 0.7.3
|
11
|
+
"undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now()%1e9,r=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};r.prototype={set:function(t,r){var i=t[this.name];return i&&i[0]===t?i[1]=r:e(t,this.name,{value:[t,r],writable:!0}),this},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){var t=e[this.name];return t&&t[0]===e?(t[0]=t[1]=void 0,!0):!1},has:function(e){var t=e[this.name];return t?t[0]===e:!1}},window.WeakMap=r}(),function(e){function t(e){O.push(e),N||(N=!0,b(i))}function r(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(e)||e}function i(){N=!1;var e=O;O=[],e.sort(function(e,t){return e.uid_-t.uid_});var t=!1;e.forEach(function(e){var r=e.takeRecords();n(e),r.length&&(e.callback_(r,e),t=!0)}),t&&i()}function n(e){e.nodes_.forEach(function(t){var r=p.get(t);r&&r.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}function a(e,t){for(var r=e;r;r=r.parentNode){var i=p.get(r);if(i)for(var n=0;n<i.length;n++){var a=i[n],s=a.options;if(r===e||s.subtree){var o=t(s);o&&a.enqueue(o)}}}}function s(e){this.callback_=e,this.nodes_=[],this.records_=[],this.uid_=++M}function o(e,t){this.type=e,this.target=t,this.addedNodes=[],this.removedNodes=[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function d(e){var t=new o(e.type,e.target);return t.addedNodes=e.addedNodes.slice(),t.removedNodes=e.removedNodes.slice(),t.previousSibling=e.previousSibling,t.nextSibling=e.nextSibling,t.attributeName=e.attributeName,t.attributeNamespace=e.attributeNamespace,t.oldValue=e.oldValue,t}function u(e,t){return D=new o(e,t)}function h(e){return w?w:(w=d(D),w.oldValue=e,w)}function c(){D=w=void 0}function v(e){return e===w||e===D}function l(e,t){return e===t?e:w&&v(e)?w:null}function f(e,t,r){this.observer=e,this.target=t,this.options=r,this.transientObservedNodes=[]}var b,p=new WeakMap;if(/Trident|Edge/.test(navigator.userAgent))b=setTimeout;else if(window.setImmediate)b=window.setImmediate;else{var g=[],m=String(Math.random());window.addEventListener("message",function(e){if(e.data===m){var t=g;g=[],t.forEach(function(e){e()})}}),b=function(e){g.push(e),window.postMessage(m,"*")}}var N=!1,O=[],M=0;s.prototype={observe:function(e,t){if(e=r(e),!t.childList&&!t.attributes&&!t.characterData||t.attributeOldValue&&!t.attributes||t.attributeFilter&&t.attributeFilter.length&&!t.attributes||t.characterDataOldValue&&!t.characterData)throw new SyntaxError;var i=p.get(e);i||p.set(e,i=[]);for(var n,a=0;a<i.length;a++)if(i[a].observer===this){n=i[a],n.removeListeners(),n.options=t;break}n||(n=new f(this,e,t),i.push(n),this.nodes_.push(e)),n.addListeners()},disconnect:function(){this.nodes_.forEach(function(e){for(var t=p.get(e),r=0;r<t.length;r++){var i=t[r];if(i.observer===this){i.removeListeners(),t.splice(r,1);break}}},this),this.records_=[]},takeRecords:function(){var e=this.records_;return this.records_=[],e}};var D,w;f.prototype={enqueue:function(e){var r=this.observer.records_,i=r.length;if(r.length>0){var n=r[i-1],a=l(n,e);if(a)return void(r[i-1]=a)}else t(this.observer);r[i]=e},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListener("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",this,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(e){if(e!==this.target){this.addListeners_(e),this.transientObservedNodes.push(e);var t=p.get(e);t||p.set(e,t=[]),t.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e.forEach(function(e){this.removeListeners_(e);for(var t=p.get(e),r=0;r<t.length;r++)if(t[r]===this){t.splice(r,1);break}},this)},handleEvent:function(e){switch(e.stopImmediatePropagation(),e.type){case"DOMAttrModified":var t=e.attrName,r=e.relatedNode.namespaceURI,i=e.target,n=new u("attributes",i);n.attributeName=t,n.attributeNamespace=r;var s=e.attrChange===MutationEvent.ADDITION?null:e.prevValue;a(i,function(e){return!e.attributes||e.attributeFilter&&e.attributeFilter.length&&-1===e.attributeFilter.indexOf(t)&&-1===e.attributeFilter.indexOf(r)?void 0:e.attributeOldValue?h(s):n});break;case"DOMCharacterDataModified":var i=e.target,n=u("characterData",i),s=e.prevValue;a(i,function(e){return e.characterData?e.characterDataOldValue?h(s):n:void 0});break;case"DOMNodeRemoved":this.addTransientObserver(e.target);case"DOMNodeInserted":var o,d,v=e.target;"DOMNodeInserted"===e.type?(o=[v],d=[]):(o=[],d=[v]);var l=v.previousSibling,f=v.nextSibling,n=u("childList",e.target.parentNode);n.addedNodes=o,n.removedNodes=d,n.previousSibling=l,n.nextSibling=f,a(e.relatedNode,function(e){return e.childList?n:void 0})}c()}},e.JsMutationObserver=s,e.MutationObserver||(e.MutationObserver=s)}(this);
|
@@ -0,0 +1,125 @@
|
|
1
|
+
webcomponents.js
|
2
|
+
================
|
3
|
+
|
4
|
+
[![Join the chat at https://gitter.im/webcomponents/webcomponentsjs](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/webcomponents/webcomponentsjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
5
|
+
|
6
|
+
A suite of polyfills supporting the [Web Components](http://webcomponents.org) specs:
|
7
|
+
|
8
|
+
**Custom Elements**: allows authors to define their own custom tags ([spec](https://w3c.github.io/webcomponents/spec/custom/)).
|
9
|
+
|
10
|
+
**HTML Imports**: a way to include and reuse HTML documents via other HTML documents ([spec](https://w3c.github.io/webcomponents/spec/imports/)).
|
11
|
+
|
12
|
+
**Shadow DOM**: provides encapsulation by hiding DOM subtrees under shadow roots ([spec](https://w3c.github.io/webcomponents/spec/shadow/)).
|
13
|
+
|
14
|
+
This also folds in polyfills for `MutationObserver` and `WeakMap`.
|
15
|
+
|
16
|
+
|
17
|
+
## Releases
|
18
|
+
|
19
|
+
Pre-built (concatenated & minified) versions of the polyfills are maintained in the [tagged versions](https://github.com/webcomponents/webcomponentsjs/releases) of this repo. There are two variants:
|
20
|
+
|
21
|
+
`webcomponents.js` includes all of the polyfills.
|
22
|
+
|
23
|
+
`webcomponents-lite.js` includes all polyfills except for shadow DOM.
|
24
|
+
|
25
|
+
|
26
|
+
## Browser Support
|
27
|
+
|
28
|
+
Our polyfills are intended to work in the latest versions of evergreen browsers. See below
|
29
|
+
for our complete browser support matrix:
|
30
|
+
|
31
|
+
| Polyfill | IE10 | IE11+ | Chrome* | Firefox* | Safari 7+* | Chrome Android* | Mobile Safari* |
|
32
|
+
| ---------- |:----:|:-----:|:-------:|:--------:|:----------:|:---------------:|:--------------:|
|
33
|
+
| Custom Elements | ~ | ✓ | ✓ | ✓ | ✓ | ✓| ✓ |
|
34
|
+
| HTML Imports | ~ | ✓ | ✓ | ✓ | ✓| ✓| ✓ |
|
35
|
+
| Shadow DOM | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
36
|
+
| Templates | ✓ | ✓ | ✓ | ✓| ✓ | ✓ | ✓ |
|
37
|
+
|
38
|
+
|
39
|
+
*Indicates the current version of the browser
|
40
|
+
|
41
|
+
~Indicates support may be flaky. If using Custom Elements or HTML Imports with Shadow DOM,
|
42
|
+
you will get the non-flaky Mutation Observer polyfill that Shadow DOM includes.
|
43
|
+
|
44
|
+
The polyfills may work in older browsers, however require additional polyfills (such as classList)
|
45
|
+
to be used. We cannot guarantee support for browsers outside of our compatibility matrix.
|
46
|
+
|
47
|
+
|
48
|
+
### Manually Building
|
49
|
+
|
50
|
+
If you wish to build the polyfills yourself, you'll need `node` and `gulp` on your system:
|
51
|
+
|
52
|
+
* install [node.js](http://nodejs.org/) using the instructions on their website
|
53
|
+
* use `npm` to install [gulp.js](http://gulpjs.com/): `npm install -g gulp`
|
54
|
+
|
55
|
+
Now you are ready to build the polyfills with:
|
56
|
+
|
57
|
+
# install dependencies
|
58
|
+
npm install
|
59
|
+
# build
|
60
|
+
gulp build
|
61
|
+
|
62
|
+
The builds will be placed into the `dist/` directory.
|
63
|
+
|
64
|
+
## Contribute
|
65
|
+
|
66
|
+
See the [contributing guide](CONTRIBUTING.md)
|
67
|
+
|
68
|
+
## License
|
69
|
+
|
70
|
+
Everything in this repository is BSD style license unless otherwise specified.
|
71
|
+
|
72
|
+
Copyright (c) 2015 The Polymer Authors. All rights reserved.
|
73
|
+
|
74
|
+
## Helper utilities
|
75
|
+
|
76
|
+
### `WebComponentsReady`
|
77
|
+
|
78
|
+
Under native HTML Imports, `<script>` tags in the main document block the loading of such imports. This is to ensure the imports have loaded and any registered elements in them have been upgraded.
|
79
|
+
|
80
|
+
The webcomponents.js and webcomponents-lite.js polyfills parse element definitions and handle their upgrade asynchronously. If prematurely fetching the element from the DOM before it has an opportunity to upgrade, you'll be working with an `HTMLUnknownElement`.
|
81
|
+
|
82
|
+
For these situations (or when you need an approximate replacement for the Polymer 0.5 `polymer-ready` behavior), you can use the `WebComponentsReady` event as a signal before interacting with the element. The criteria for this event to fire is all Custom Elements with definitions registered by the time HTML Imports available at load time have loaded have upgraded.
|
83
|
+
|
84
|
+
```js
|
85
|
+
window.addEventListener('WebComponentsReady', function(e) {
|
86
|
+
// imports are loaded and elements have been registered
|
87
|
+
console.log('Components are ready');
|
88
|
+
});
|
89
|
+
```
|
90
|
+
|
91
|
+
## Known Issues
|
92
|
+
|
93
|
+
* [Custom element's constructor property is unreliable](#constructor)
|
94
|
+
* [Contenteditable elements do not trigger MutationObserver](#contentedit)
|
95
|
+
* [ShadowCSS: :host-context(...):host(...) doesn't work](#hostcontext)
|
96
|
+
* [execCommand isn't supported under Shadow DOM](#execcommand)
|
97
|
+
|
98
|
+
### Custom element's constructor property is unreliable <a id="constructor"></a>
|
99
|
+
See [#215](https://github.com/webcomponents/webcomponentsjs/issues/215) for background.
|
100
|
+
|
101
|
+
In Safari and IE, instances of Custom Elements have a `constructor` property of `HTMLUnknownElementConstructor` and `HTMLUnknownElement`, respectively. It's unsafe to rely on this property for checking element types.
|
102
|
+
|
103
|
+
It's worth noting that `customElement.__proto__.__proto__.constructor` is `HTMLElementPrototype` and that the prototype chain isn't modified by the polyfills(onto `ElementPrototype`, etc.)
|
104
|
+
|
105
|
+
### Contenteditable elements do not trigger MutationObserver <a id="contentedit"></a>
|
106
|
+
Using the MutationObserver polyfill, it isn't possible to monitor mutations of an element marked `contenteditable`.
|
107
|
+
See [the mailing list](https://groups.google.com/forum/#!msg/polymer-dev/LHdtRVXXVsA/v1sGoiTYWUkJ)
|
108
|
+
|
109
|
+
### ShadowCSS: :host-context(...):host(...) doesn't work <a id="hostcontext"></a>
|
110
|
+
See [#16](https://github.com/webcomponents/webcomponentsjs/issues/16) for background.
|
111
|
+
|
112
|
+
Under the shadow DOM polyfill, rules like:
|
113
|
+
```
|
114
|
+
:host-context(.foo):host(.bar) {...}
|
115
|
+
```
|
116
|
+
don't work, despite working under native Shadow DOM. The solution is to use `polyfill-next-selector` like:
|
117
|
+
|
118
|
+
```
|
119
|
+
polyfill-next-selector { content: '.foo :host.bar, :host.foo.bar'; }
|
120
|
+
```
|
121
|
+
|
122
|
+
### execCommand and contenteditable isn't supported under Shadow DOM <a id="execcommand"></a>
|
123
|
+
See [#212](https://github.com/webcomponents/webcomponentsjs/issues/212)
|
124
|
+
|
125
|
+
`execCommand`, and `contenteditable` aren't supported under the ShadowDOM polyfill, with commands that insert or remove nodes being especially prone to failure.
|