Skip to content

[WIP] Fix HTML escaping and non-top-level <script> and <style> issues #1086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 9, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
store <script> and <style> contents on Element node itself
  • Loading branch information
Conduitry committed Jan 8, 2018
commit c42e6f9d71d3d547247a9494a31dea32e1e1baa1
6 changes: 2 additions & 4 deletions src/parse/state/tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,9 @@ export default function tag(parser: Parser) {
element.end = parser.index;
} else if (name === 'script' || name === 'style') {
// special case
const start = parser.index;
const data = parser.readUntil(new RegExp(`</${name}>`));
const end = parser.index;
element.children.push({ start, end, type: 'Text', data });
element.data = parser.readUntil(new RegExp(`</${name}>`));
parser.eat(`</${name}>`, true);
element.end = parser.index;
} else {
parser.stack.push(element);
}
Expand Down