-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Revert DOM clean up methods (#160)
* Revert DOM clean up methods Given this JSBin: https://jsbin.com/?html,console,output When we serialize the CSSOM into the `<style>` tag that the in-memory styles own and then _remove_ those styles, it triggers `deleteRule` on those styles in the CSSOM. Which means we're removing the text we injected AND all of the styles that live in memory. This breaks their app. With the input cleaning, when we remove the value or checked attribute on the element, it's possible those elements lose their values entirely. For example, when we remove the `checked` attribute from checkboxes in the customers DOM, this will make the checkbox _no longer checked_, which is changing the state of their application. It would be better, in this world without an AST, to leave the mutations in place. Removing the mutations causes more issues than it tries to solve. * Update test cases
- Loading branch information
Showing
9 changed files
with
35 additions
and
101 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
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,13 @@ | ||
<html> | ||
<head> | ||
<title>CSSOM testing</title> | ||
<style type="text/css"></style> | ||
<script> | ||
let styleSheet = document.styleSheets[0]; | ||
styleSheet.insertRule('.box { height: 500px; width: 500px; background-color: green; }') | ||
</script> | ||
</head> | ||
<body> | ||
<div class="box"></div> | ||
</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
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