less_assets 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -158,7 +158,7 @@ Rendered with only some of the variables passed to the template
158
158
  JSST['box']({ 'box-margin': '20px' })
159
159
  ```
160
160
 
161
- will use the default values that result in
161
+ will use the default values that results in
162
162
 
163
163
  ```CSS
164
164
  .box {
@@ -182,13 +182,13 @@ div {
182
182
  that is compiled with
183
183
 
184
184
  ```JavaScript
185
- JSST['header']({ m: '20px' }, document)
185
+ JSST['divider']({ m: '20px' }, document)
186
186
  ```
187
187
 
188
188
  will create a new style tag in the head of the document:
189
189
 
190
190
  ```HTML
191
- <style id="less_asset_header">
191
+ <style id="less_asset_divider">
192
192
  div {
193
193
  margin-top: 20px;
194
194
  }
@@ -1,5 +1,5 @@
1
1
  # coding: UTF-8
2
2
 
3
3
  module LessAssets
4
- VERSION = '0.2.0' unless defined?(LessAssets::VERSION)
4
+ VERSION = '0.2.1' unless defined?(LessAssets::VERSION)
5
5
  end
@@ -38,14 +38,14 @@ class window.LessAssets
38
38
 
39
39
  # Add a style tag with the css when a document is given
40
40
  #
41
- if doc instanceof HTMLDocument
41
+ if doc instanceof HTMLDocument || Object.prototype.toString.call(doc) is '[object HTMLDocument]'
42
42
  id = "less_asset_#{ name.replace(/[^A-Za-z0-1_/-]/, '').replace(/[/-]/, '_') }"
43
43
 
44
- style = document.getElementById(id) || document.createElement 'style'
44
+ style = doc.getElementById(id) || doc.createElement 'style'
45
45
  style.type = 'text/css'
46
46
  style.id = id
47
47
 
48
- rules = document.createTextNode result
48
+ rules = doc.createTextNode result
49
49
 
50
50
  if style.styleSheet
51
51
  style.styleSheet.cssText = rules.nodeValue
@@ -55,7 +55,7 @@ class window.LessAssets
55
55
 
56
56
  style.appendChild rules
57
57
 
58
- head = document.getElementsByTagName('head')[0]
59
- head.appendChild(style);
58
+ head = doc.getElementsByTagName('head')[0]
59
+ head.appendChild style
60
60
 
61
61
  result
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: less_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -89,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  segments:
91
91
  - 0
92
- hash: 3705905153218187553
92
+ hash: 590702350648315702
93
93
  required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements: