| OLD | NEW |
| 1 /// Internals to the tree builders. | 1 /// Internals to the tree builders. |
| 2 library treebuilder; | 2 library treebuilder; |
| 3 | 3 |
| 4 import 'dart:collection'; | 4 import 'dart:collection'; |
| 5 import 'package:html/dom.dart'; | 5 import 'package:html/dom.dart'; |
| 6 import 'package:html/parser.dart' show getElementNameTuple; | 6 import 'package:html/parser.dart' show getElementNameTuple; |
| 7 import 'package:source_span/source_span.dart'; | 7 import 'package:source_span/source_span.dart'; |
| 8 import 'constants.dart'; | 8 import 'constants.dart'; |
| 9 import 'list_proxy.dart'; | 9 import 'list_proxy.dart'; |
| 10 import 'token.dart'; | 10 import 'token.dart'; |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 } | 345 } |
| 346 | 346 |
| 347 /// Get the foster parent element, and sibling to insert before | 347 /// Get the foster parent element, and sibling to insert before |
| 348 /// (or null) when inserting a misnested table node | 348 /// (or null) when inserting a misnested table node |
| 349 List<Node> getTableMisnestedNodePosition() { | 349 List<Node> getTableMisnestedNodePosition() { |
| 350 // The foster parent element is the one which comes before the most | 350 // The foster parent element is the one which comes before the most |
| 351 // recently opened table element | 351 // recently opened table element |
| 352 // XXX - this is really inelegant | 352 // XXX - this is really inelegant |
| 353 Node lastTable = null; | 353 Node lastTable = null; |
| 354 Node fosterParent = null; | 354 Node fosterParent = null; |
| 355 var insertBefore = null; | 355 Node insertBefore = null; |
| 356 for (var elm in openElements.reversed) { | 356 for (var elm in openElements.reversed) { |
| 357 if (elm.localName == "table") { | 357 if (elm.localName == "table") { |
| 358 lastTable = elm; | 358 lastTable = elm; |
| 359 break; | 359 break; |
| 360 } | 360 } |
| 361 } | 361 } |
| 362 if (lastTable != null) { | 362 if (lastTable != null) { |
| 363 // XXX - we should really check that this parent is actually a | 363 // XXX - we should really check that this parent is actually a |
| 364 // node here | 364 // node here |
| 365 if (lastTable.parentNode != null) { | 365 if (lastTable.parentNode != null) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 Document getDocument() => document; | 399 Document getDocument() => document; |
| 400 | 400 |
| 401 /// Return the final fragment. | 401 /// Return the final fragment. |
| 402 DocumentFragment getFragment() { | 402 DocumentFragment getFragment() { |
| 403 //XXX assert innerHTML | 403 //XXX assert innerHTML |
| 404 var fragment = new DocumentFragment(); | 404 var fragment = new DocumentFragment(); |
| 405 openElements[0].reparentChildren(fragment); | 405 openElements[0].reparentChildren(fragment); |
| 406 return fragment; | 406 return fragment; |
| 407 } | 407 } |
| 408 } | 408 } |
| OLD | NEW |