Skip to content

Commit

Permalink
Do not assign to a readonly property on window
Browse files Browse the repository at this point in the history
If `window.customElements` exists there's a good chance that it's a readonly property as per spec, and assigning to readonly properties throws an exception in strict mode.
  • Loading branch information
rictic committed Jul 23, 2017
1 parent e03b2cc commit b64e486
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion test/unit/shady-content.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
<head>
<meta charset="utf-8">
<script>
window.customElements = window.customElements || {};
if (!window.customElements) {
window.customElements = {};
}
customElements.forcePolyfill = true;
window.ShadyDOM = {
force: true
Expand Down
4 changes: 3 additions & 1 deletion test/unit/shady-dynamic.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
<head>
<meta charset="utf-8">
<script>
window.customElements = window.customElements || {};
if (!window.customElements) {
window.customElements = {};
}
customElements.forcePolyfill = true;
window.ShadyDOM = {
force: true
Expand Down
4 changes: 3 additions & 1 deletion test/unit/shady-events.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
<html>
<head>
<script>
window.customElements = window.customElements || {};
if (!window.customElements) {
window.customElements = {};
}
customElements.forcePolyfill = true;
window.ShadyDOM = {
force: true
Expand Down

0 comments on commit b64e486

Please sign in to comment.