| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 class XMLDocumentWrappingImplementation extends DocumentWrappingImplementation | 5 class XMLDocumentWrappingImplementation extends DocumentWrappingImplementation |
| 6 implements XMLDocument { | 6 implements XMLDocument { |
| 7 // This really just wants to extend both DocumentWrappingImplementation and | 7 // This really just wants to extend both DocumentWrappingImplementation and |
| 8 // XMLElementWrappingImplementation, but since that's not possible we delegate | 8 // XMLElementWrappingImplementation, but since that's not possible we delegate |
| 9 // to the latter. | 9 // to the latter. |
| 10 XMLElement documentEl; | 10 XMLElement documentEl; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // | 30 // |
| 31 // TODO(nweiz): This is pretty hacky, it would be nice to this some other | 31 // TODO(nweiz): This is pretty hacky, it would be nice to this some other |
| 32 // way if we can find one. | 32 // way if we can find one. |
| 33 if (!xml.toLowerCase().contains('<parsererror') && | 33 if (!xml.toLowerCase().contains('<parsererror') && |
| 34 xmlDoc.query('parsererror') != null) { | 34 xmlDoc.query('parsererror') != null) { |
| 35 throw new IllegalArgumentException('Error parsing XML: "$xml"'); | 35 throw new IllegalArgumentException('Error parsing XML: "$xml"'); |
| 36 } | 36 } |
| 37 return xmlDoc; | 37 return xmlDoc; |
| 38 } | 38 } |
| 39 | 39 |
| 40 Node get parent() => null; | 40 Node get parent => null; |
| 41 | 41 |
| 42 Node _insertAdjacentNode(String where, Node node) { | 42 Node _insertAdjacentNode(String where, Node node) { |
| 43 switch (where.toLowerCase()) { | 43 switch (where.toLowerCase()) { |
| 44 case "beforebegin": | 44 case "beforebegin": |
| 45 return null; | 45 return null; |
| 46 case "afterend": | 46 case "afterend": |
| 47 return null; | 47 return null; |
| 48 case "afterbegin": | 48 case "afterbegin": |
| 49 this.insertBefore(node, nodes.first); | 49 this.insertBefore(node, nodes.first); |
| 50 return node; | 50 return node; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 62 void insertAdjacentText([String where = null, String text = null]) { | 62 void insertAdjacentText([String where = null, String text = null]) { |
| 63 this._insertAdjacentNode(where, new Text(text)); | 63 this._insertAdjacentNode(where, new Text(text)); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void insertAdjacentHTML( | 66 void insertAdjacentHTML( |
| 67 [String position_OR_where = null, String text = null]) { | 67 [String position_OR_where = null, String text = null]) { |
| 68 this._insertAdjacentNode( | 68 this._insertAdjacentNode( |
| 69 position_OR_where, new DocumentFragment.xml(text)); | 69 position_OR_where, new DocumentFragment.xml(text)); |
| 70 } | 70 } |
| 71 | 71 |
| 72 Future<ElementRect> get rect() => documentEl.rect; | 72 Future<ElementRect> get rect => documentEl.rect; |
| 73 | 73 |
| 74 Future<Range> caretRangeFromPoint([int x = null, int y = null]) => | 74 Future<Range> caretRangeFromPoint([int x = null, int y = null]) => |
| 75 new Future<Range>.immediate(null); | 75 new Future<Range>.immediate(null); |
| 76 | 76 |
| 77 Future<Element> elementFromPoint([int x = null, int y = null]) => | 77 Future<Element> elementFromPoint([int x = null, int y = null]) => |
| 78 new Future<Element>.immediate(null); | 78 new Future<Element>.immediate(null); |
| 79 | 79 |
| 80 bool execCommand([String command = null, bool userInterface = null, | 80 bool execCommand([String command = null, bool userInterface = null, |
| 81 String value = null]) => false; | 81 String value = null]) => false; |
| 82 | 82 |
| 83 bool queryCommandEnabled([String command = null]) => false; | 83 bool queryCommandEnabled([String command = null]) => false; |
| 84 bool queryCommandIndeterm([String command = null]) => false; | 84 bool queryCommandIndeterm([String command = null]) => false; |
| 85 bool queryCommandState([String command = null]) => false; | 85 bool queryCommandState([String command = null]) => false; |
| 86 bool queryCommandSupported([String command = null]) => false; | 86 bool queryCommandSupported([String command = null]) => false; |
| 87 void blur() {} | 87 void blur() {} |
| 88 void focus() {} | 88 void focus() {} |
| 89 void scrollByLines([int lines = null]) {} | 89 void scrollByLines([int lines = null]) {} |
| 90 void scrollByPages([int pages = null]) {} | 90 void scrollByPages([int pages = null]) {} |
| 91 void scrollIntoView([bool centerIfNeeded = null]) {} | 91 void scrollIntoView([bool centerIfNeeded = null]) {} |
| 92 XMLElement get activeElement() => null; | 92 XMLElement get activeElement => null; |
| 93 String get domain() => ""; | 93 String get domain => ""; |
| 94 | 94 |
| 95 void set body(Element value) { | 95 void set body(Element value) { |
| 96 throw new UnsupportedOperationException("XML documents don't have a body."); | 96 throw new UnsupportedOperationException("XML documents don't have a body."); |
| 97 } | 97 } |
| 98 | 98 |
| 99 String get cookie() { | 99 String get cookie { |
| 100 throw new UnsupportedOperationException( | 100 throw new UnsupportedOperationException( |
| 101 "XML documents don't support cookies."); | 101 "XML documents don't support cookies."); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void set cookie(String value) { | 104 void set cookie(String value) { |
| 105 throw new UnsupportedOperationException( | 105 throw new UnsupportedOperationException( |
| 106 "XML documents don't support cookies."); | 106 "XML documents don't support cookies."); |
| 107 } | 107 } |
| 108 | 108 |
| 109 String get manifest() => ""; | 109 String get manifest => ""; |
| 110 | 110 |
| 111 void set manifest(String value) { | 111 void set manifest(String value) { |
| 112 throw new UnsupportedOperationException( | 112 throw new UnsupportedOperationException( |
| 113 "Manifest can't be set for XML documents."); | 113 "Manifest can't be set for XML documents."); |
| 114 } | 114 } |
| 115 | 115 |
| 116 CSSClassSet get classes() => documentEl.classes; | 116 CSSClassSet get classes => documentEl.classes; |
| 117 | 117 |
| 118 ElementList get elements() => documentEl.elements; | 118 ElementList get elements => documentEl.elements; |
| 119 | 119 |
| 120 void set elements(Collection<Element> value) { documentEl.elements = value; } | 120 void set elements(Collection<Element> value) { documentEl.elements = value; } |
| 121 | 121 |
| 122 String get outerHTML() => documentEl.outerHTML; | 122 String get outerHTML => documentEl.outerHTML; |
| 123 | 123 |
| 124 String get innerHTML() => documentEl.innerHTML; | 124 String get innerHTML => documentEl.innerHTML; |
| 125 | 125 |
| 126 void set innerHTML(String xml) { documentEl.innerHTML = xml; } | 126 void set innerHTML(String xml) { documentEl.innerHTML = xml; } |
| 127 | 127 |
| 128 String get contentEditable() => documentEl.contentEditable; | 128 String get contentEditable => documentEl.contentEditable; |
| 129 | 129 |
| 130 void set contentEditable(String value) { documentEl.contentEditable = value; } | 130 void set contentEditable(String value) { documentEl.contentEditable = value; } |
| 131 | 131 |
| 132 bool get isContentEditable() => documentEl.isContentEditable; | 132 bool get isContentEditable => documentEl.isContentEditable; |
| 133 | 133 |
| 134 bool get draggable() => documentEl.draggable; | 134 bool get draggable => documentEl.draggable; |
| 135 | 135 |
| 136 void set draggable(bool value) { documentEl.draggable = value; } | 136 void set draggable(bool value) { documentEl.draggable = value; } |
| 137 | 137 |
| 138 bool get spellcheck() => documentEl.spellcheck; | 138 bool get spellcheck => documentEl.spellcheck; |
| 139 | 139 |
| 140 void set spellcheck(bool value) { documentEl.spellcheck = value; } | 140 void set spellcheck(bool value) { documentEl.spellcheck = value; } |
| 141 | 141 |
| 142 bool get hidden() => documentEl.hidden; | 142 bool get hidden => documentEl.hidden; |
| 143 | 143 |
| 144 void set hidden(bool value) { documentEl.hidden = value; } | 144 void set hidden(bool value) { documentEl.hidden = value; } |
| 145 | 145 |
| 146 int get tabIndex() => documentEl.tabIndex; | 146 int get tabIndex => documentEl.tabIndex; |
| 147 | 147 |
| 148 void set tabIndex(int value) { documentEl.tabIndex = value; } | 148 void set tabIndex(int value) { documentEl.tabIndex = value; } |
| 149 | 149 |
| 150 String get id() => documentEl.id; | 150 String get id => documentEl.id; |
| 151 | 151 |
| 152 void set id(String value) { documentEl.id = value; } | 152 void set id(String value) { documentEl.id = value; } |
| 153 | 153 |
| 154 String get title() => documentEl.title; | 154 String get title => documentEl.title; |
| 155 | 155 |
| 156 void set title(String value) { documentEl.title = value; } | 156 void set title(String value) { documentEl.title = value; } |
| 157 | 157 |
| 158 String get webkitdropzone() => documentEl.webkitdropzone; | 158 String get webkitdropzone => documentEl.webkitdropzone; |
| 159 | 159 |
| 160 void set webkitdropzone(String value) { documentEl.webkitdropzone = value; } | 160 void set webkitdropzone(String value) { documentEl.webkitdropzone = value; } |
| 161 | 161 |
| 162 String get lang() => documentEl.lang; | 162 String get lang => documentEl.lang; |
| 163 | 163 |
| 164 void set lang(String value) { documentEl.lang = value; } | 164 void set lang(String value) { documentEl.lang = value; } |
| 165 | 165 |
| 166 String get dir() => documentEl.dir; | 166 String get dir => documentEl.dir; |
| 167 | 167 |
| 168 void set dir(String value) { documentEl.dir = value; } | 168 void set dir(String value) { documentEl.dir = value; } |
| 169 } | 169 } |
| OLD | NEW |