react-shadow
Advanced tools
Comparing version 0.1.5 to 0.1.6
{ | ||
"name": "react-shadow", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"homepage": "https://github.com/Wildhoney/ReactShadow", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -36,3 +36,2 @@ (function main($window, $document) { | ||
this.attachCSSDocuments(templateElement); | ||
console.log(templateElement); | ||
@@ -39,0 +38,0 @@ // Append the template node's content to our component. |
@@ -36,3 +36,2 @@ (function main($window, $document) { | ||
this.attachCSSDocuments(templateElement); | ||
console.log(templateElement); | ||
@@ -39,0 +38,0 @@ // Append the template node's content to our component. |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"use strict";t.ReactShadow={shadowRoot:{},componentDidMount:function(){var t=e.createElement("script");this.getDOMNode().parentNode.appendChild(t),t.appendChild(this.getDOMNode());var n=this.shadowRoot=this.getDOMNode().parentNode.parentNode.createShadowRoot(),o=e.createElement("template");o.content.appendChild(this.getDOMNode().cloneNode(!0)),this.attachCSSDocuments(o),console.log(o);var i=e.importNode(o.content,!0);n.appendChild(i),this.interceptEvents()},interceptEvents:function(){var t=function(t){t.stopPropagation(),t.preventDefault();var n=t.target.getAttribute("data-reactid"),o=e.querySelector('*[data-reactid="'+n+'"]'),i=e.createEvent("Events");i.initEvent(t.type,!0,!1),o.dispatchEvent(i)},n=["click","dblclick","mouseup","mouseout","mouseover","mousedown","mouseenter","mouseleave","contextmenu"];n.forEach(function(e){this.shadowRoot.addEventListener(e,t)}.bind(this))},componentDidUpdate:function(){var t=this.shadowRoot.querySelector(":not(style)");t.innerHTML="";for(var e=this.getDOMNode(),n=e.children,o=n.length,i=0;o>i;i++)t.appendChild(e.children[i].cloneNode(!0))},attachCSSDocuments:function(t){if(this.cssDocuments){var n="function"==typeof this.cssDocuments,o=n?this.cssDocuments():this.cssDocuments;o.forEach(function(n){var o=e.createElement("style");o.innerHTML='@import "'+n+'"',t.content.appendChild(o)})}return t}}}(window,window.document); | ||
!function(t,e){"use strict";t.ReactShadow={shadowRoot:{},componentDidMount:function(){var t=e.createElement("script");this.getDOMNode().parentNode.appendChild(t),t.appendChild(this.getDOMNode());var n=this.shadowRoot=this.getDOMNode().parentNode.parentNode.createShadowRoot(),o=e.createElement("template");o.content.appendChild(this.getDOMNode().cloneNode(!0)),this.attachCSSDocuments(o);var i=e.importNode(o.content,!0);n.appendChild(i),this.interceptEvents()},interceptEvents:function(){var t=function(t){t.stopPropagation(),t.preventDefault();var n=t.target.getAttribute("data-reactid"),o=e.querySelector('*[data-reactid="'+n+'"]'),i=e.createEvent("Events");i.initEvent(t.type,!0,!1),o.dispatchEvent(i)},n=["click","dblclick","mouseup","mouseout","mouseover","mousedown","mouseenter","mouseleave","contextmenu"];n.forEach(function(e){this.shadowRoot.addEventListener(e,t)}.bind(this))},componentDidUpdate:function(){var t=this.shadowRoot.querySelector(":not(style)");t.innerHTML="";for(var e=this.getDOMNode(),n=e.children,o=n.length,i=0;o>i;i++)t.appendChild(e.children[i].cloneNode(!0))},attachCSSDocuments:function(t){if(this.cssDocuments){var n="function"==typeof this.cssDocuments,o=n?this.cssDocuments():this.cssDocuments;o.forEach(function(n){var o=e.createElement("style");o.innerHTML='@import "'+n+'"',t.content.appendChild(o)})}return t}}}(window,window.document); |
{ | ||
"name": "react-shadow", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Use Shadow DOM with React.js and CSS imports; write your component styles in CSS!", | ||
@@ -5,0 +5,0 @@ "main": "dist/react-shadow.min.js", |
494635
26
398