Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 441623

Summary: [HTML][Outline] HTML outline selects wrong ranges when !DOCTYPE is used
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: ClientAssignee: Curtis Windatt <curtis.windatt.public>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: curtis.windatt.public
Version: unspecified   
Target Milestone: 7.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on:    
Bug Blocks: 463519    
Attachments:
Description Flags
screen shot none

Description Michael Rennie CLA 2014-08-12 14:19:43 EDT
Created attachment 245926 [details]
screen shot

The HTML outline selects the wrong ranges when you select an item in the outline.

See attached screen shot
Comment 1 Curtis Windatt CLA 2014-08-13 15:48:20 EDT
The outline works for a lot of HTML pages even if multiple tags are moved onto one line, but adding !DOCTYPE messes up everything on that line.

<!DOCTYPE html><head><script  >var foo;foo = 2;</script></head>
<body>
Hi
</body>

</html>
Comment 2 Curtis Windatt CLA 2014-08-14 16:01:26 EDT
This is a bug in the Tautologistics HTML parser library.  If a node is skipped (not written out to the tree) such as !DOCTYPE, the code fails to call _updateLocation() which increases the line/col based on the found node.
Comment 3 Curtis Windatt CLA 2014-08-14 16:35:44 EDT
The doctype node support:
https://github.com/tautologistics/node-htmlparser/pull/48

The fix fails to update the location correctly.

Fixed in master
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=f05495cf1a7c54917f2cd3eafdd612786a9999a7

Note that the snippet given here is incorrect html. The DOCTYPE DTD directive is not a tag, so it must be followed by the opening <html> tag


<!DOCTYPE html>
<html>
<head><script  >var foo;foo = 2;</script></head>
<body>
Hi
</body>

</html>