This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 758
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add parser support for HTML files (#2810)
* add parser support for HTML files * add test and fixture for parsing script in HTML files
- Loading branch information
1 parent
f9e048a
commit 570fb08
Showing
5 changed files
with
97 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<html> | ||
<head> | ||
<script type="text/javascript"> | ||
var globalObject = { | ||
first: "name", | ||
last: "words" | ||
}; | ||
function sayHello (name) { | ||
return `Hello, ${name}!`; | ||
} | ||
</script> | ||
<style> | ||
BODY { | ||
font-size: 48px; | ||
color: rebeccapurple; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1>Testing Script Tags in HTML</h1> | ||
<script> | ||
const capitalize = name => { | ||
return name[0].toUpperCase() + name.substring(1) | ||
}; | ||
const greetAll = ["my friend", "buddy", "world"] | ||
.map(capitalize) | ||
.map(sayHello) | ||
.join("\n"); | ||
|
||
globalObject.greetings = greetAll; | ||
</script> | ||
<p> | ||
Some arbitrary intermediate content to affect the offsets of the scripts | ||
</p> | ||
<script> | ||
(function iife() { | ||
const greeting = sayHello("Ryan"); | ||
console.log(greeting); | ||
})(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters