This repository was archived by the owner on Feb 22, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -177,8 +177,17 @@ class JQuery extends DelegatingList<Node> {
177
177
_toHtml (node, [bool outer = false ]) {
178
178
if (node is Comment ) {
179
179
return '<!--${node .text }-->' ;
180
+ } else if (node is Element ) {
181
+ // Remove all the "ng-binding" internal classes
182
+ node = node.clone (true ) as Element ;
183
+ node.queryAll (".ng-binding" ).forEach ((Element e) {
184
+ e.classes.remove ('ng-binding' );
185
+ });
186
+ var htmlString = outer ? node.outerHtml : node.innerHtml;
187
+ // Strip out empty class attributes. This seems like a Dart bug...
188
+ return htmlString.replaceAll (' class=""' , '' );
180
189
} else {
181
- return outer ? node.outerHtml : node.innerHtml ;
190
+ throw "JQuery._toHtml not implemented for node type [${ node .nodeType }]" ;
182
191
}
183
192
}
184
193
Original file line number Diff line number Diff line change @@ -30,6 +30,11 @@ main() {
30
30
expect (div.html ()).toEqual ('' );
31
31
});
32
32
33
+ it ('should strip ng-binding' , () {
34
+ var div = $('<div><span class="ng-binding"></span></div>' );
35
+ expect (div.html ()).toEqual ('<span></span>' );
36
+ });
37
+
33
38
it ('set' , (){
34
39
var div = $('<div>' );
35
40
expect (div.html ('text' )).toBe (div);
You can’t perform that action at this time.
0 commit comments