diff options
author | Ananya Sen | 2012-05-31 10:13:40 -0700 |
---|---|---|
committer | Ananya Sen | 2012-05-31 10:13:40 -0700 |
commit | 286457b4f23974277274ba388afd283e8aa085cb (patch) | |
tree | c21bf791e7c4f572d12f97987ea6b89e74da67fe /js/lib/NJUtils.js | |
parent | 4d9b481c58090e8f1fc7b0e9d73a81b0f49cccc8 (diff) | |
parent | d49c909cff7f0c5e5d0b127ad84a2fefc6677dc6 (diff) | |
download | ninja-286457b4f23974277274ba388afd283e8aa085cb.tar.gz |
Merge branch 'refs/heads/ninja-internal-master' into cut-copy-paste
Conflicts:
js/controllers/styles-controller.js
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/lib/NJUtils.js')
-rwxr-xr-x | js/lib/NJUtils.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js index 5aaeb5f2..7dd4c9e8 100755 --- a/js/lib/NJUtils.js +++ b/js/lib/NJUtils.js | |||
@@ -18,16 +18,18 @@ exports.NJUtils = Montage.create(Component, { | |||
18 | 18 | ||
19 | ///// Quick "getElementById" | 19 | ///// Quick "getElementById" |
20 | $ : { | 20 | $ : { |
21 | value: function(id) { | 21 | value: function(id, doc) { |
22 | return document.getElementById(id); | 22 | doc = doc || document; |
23 | return doc.getElementById(id); | ||
23 | } | 24 | } |
24 | }, | 25 | }, |
25 | 26 | ||
26 | ///// Quick "getElementsByClassName" which also returns as an Array | 27 | ///// Quick "getElementsByClassName" which also returns as an Array |
27 | ///// Can return as NodeList by passing true as second argument | 28 | ///// Can return as NodeList by passing true as second argument |
28 | $$ : { | 29 | $$ : { |
29 | value: function(className, asNodeList) { | 30 | value: function(className, asNodeList, doc) { |
30 | var list = document.getElementsByClassName(className); | 31 | doc = doc || document; |
32 | var list = doc.getElementsByClassName(className); | ||
31 | return (asNodeList) ? list : this.toArray(list); | 33 | return (asNodeList) ? list : this.toArray(list); |
32 | } | 34 | } |
33 | }, | 35 | }, |
@@ -62,7 +64,7 @@ exports.NJUtils = Montage.create(Component, { | |||
62 | value: function(tag, attr, doc) { | 64 | value: function(tag, attr, doc) { |
63 | var _doc, el; | 65 | var _doc, el; |
64 | 66 | ||
65 | _doc = doc ? doc._document : document; | 67 | _doc = doc ? doc.model.views.design.document : document; |
66 | el = _doc.createElement(tag); | 68 | el = _doc.createElement(tag); |
67 | this.decor(el, attr); | 69 | this.decor(el, attr); |
68 | 70 | ||