Skip to content

Commit

Permalink
injecting style from code
Browse files Browse the repository at this point in the history
  • Loading branch information
eavichay committed Dec 6, 2016
1 parent 348d1ec commit ea9bc5e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
17 changes: 17 additions & 0 deletions SlimElement.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
;(function() {


(function() {

var css = 'slim-component { all: inherit; }',
head = document.head || document.getElementsByTagName('head')[0],
style = document.createElement('style');

style.type = 'text/css';
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
head.appendChild(style);

})()


window.Slim = document.registerElement.bind(document)


Expand Down
5 changes: 3 additions & 2 deletions example/Components/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
padding: 0;
}

slim-component { all: inherit; }

body {
padding: 0;
font-size: 1.5em;
Expand Down Expand Up @@ -104,6 +102,9 @@ <h2>Featuring</h2>
<li>Repeater with array as data source</li>
</ul>

<pre>bower install slimjs
npm install slim-js</pre>

<pre><h2>Data binding and Text-to-data Binding</h2><h4>todo-task-item.js</h4><code>document.registerElement(
'todo-task-item',
class extends <strong>SlimBaseElement</strong> {
Expand Down

0 comments on commit ea9bc5e

Please sign in to comment.