diff options
author | Nivesh Rajbhandari | 2012-05-04 14:39:33 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-05-04 14:39:33 -0700 |
commit | 8f1385d4aa12173fb4d9af695b8e5036f675b621 (patch) | |
tree | 5c25b7f37150265a3ccb3097c35ef5810759d942 /js/controllers | |
parent | fec9ccee11ea21ffc95edce6e89d0d302b63e3d8 (diff) | |
download | ninja-8f1385d4aa12173fb4d9af695b8e5036f675b621.tar.gz |
Fixing selection and layout code to exclude SCRIPT and STYLE tags.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/controllers')
-rwxr-xr-x | js/controllers/selection-controller.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 5665b09c..77c065ae 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js | |||
@@ -112,12 +112,12 @@ exports.SelectionController = Montage.create(Component, { | |||
112 | 112 | ||
113 | handleSelectAll: { | 113 | handleSelectAll: { |
114 | value: function(event) { | 114 | value: function(event) { |
115 | var selected = [], childNodes = []; | 115 | var selected = [], childNodes = [], self = this; |
116 | 116 | ||
117 | childNodes = this.application.ninja.currentDocument.documentRoot.childNodes; | 117 | childNodes = this.application.ninja.currentDocument.documentRoot.childNodes; |
118 | childNodes = Array.prototype.slice.call(childNodes, 0); | 118 | childNodes = Array.prototype.slice.call(childNodes, 0); |
119 | childNodes.forEach(function(item) { | 119 | childNodes.forEach(function(item) { |
120 | if(item.nodeType == 1) { | 120 | if(self.isNodeTraversable(item)) { |
121 | selected.push(item); | 121 | selected.push(item); |
122 | } | 122 | } |
123 | }); | 123 | }); |
@@ -281,6 +281,13 @@ exports.SelectionController = Montage.create(Component, { | |||
281 | 281 | ||
282 | return -1; | 282 | return -1; |
283 | } | 283 | } |
284 | }, | ||
285 | |||
286 | isNodeTraversable: { | ||
287 | value: function( item ) { | ||
288 | if(item.nodeType !== 1) return false; | ||
289 | return ((item.nodeName !== "STYLE") && (item.nodeName !== "SCRIPT")); | ||
290 | } | ||
284 | } | 291 | } |
285 | 292 | ||
286 | }); | 293 | }); |