Splitting HTMLDocument from Document, and other code clean ups. #46
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
WithBrowsertrait, which you can mixin to test cases or other classes which needs DOM manipulation.DocumentandHTMLDocumentclasses, and change return types of some methods inDocumentfor compatibility.Previously, constructing a SVG document using
DOMParserwould result in aDocumentinstance which has lot of non-working methods, as they're intended only for HTML. Both W3C DOM API and MDN reference document also distinguish those to types of interface, so I splitted them into separate classes.And invoking
getElementById()and casting the result intoSVGElementwas problematic, since the return typeHTMLElementis not a parent type of the former.I tried to group those attributes which roughly have related meaning. And I also added @deprecated annotation to some of the attributes of which MDN document clearly indicates as deprecated.
Still, there are lot of methods and attributes in
HTMLDocumentwhich are either outdated or IE specific, so we might need to extract them later into something likeIEDocumentExtension.