-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#283: Fix a typo that prevents the document construction observer fro…
…m being created.
- Loading branch information
Showing
3 changed files
with
49 additions
and
1 deletion.
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
47 changes: 47 additions & 0 deletions
47
packages/tests/custom-elements/html/DocumentConstructionObserver.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>DocumentConstructionObserver</title> | ||
<script> | ||
(window.customElements = window.customElements || {}).forcePolyfill = true; | ||
</script> | ||
<script src="../../node_modules/es6-promise/dist/es6-promise.auto.min.js"></script> | ||
<script src="../../node_modules/wct-browser-legacy/browser.js"></script> | ||
<script src="../../node_modules/@webcomponents/custom-elements/custom-elements.min.js"></script> | ||
<script> | ||
// This needs to be a classic script so that it runs before the parser gets | ||
// to <body>. | ||
|
||
// This snippet is copied from '../safari-gc-bug-workaround.js' because this | ||
// test suite can't use the Safari GC workaround script as a module: it | ||
// specifically tests behavior of a definition provided before the document's | ||
// body has begun to be parsed. | ||
if (customElements.polyfillWrapFlushCallback === undefined) { | ||
window.__CE_installPolyfill(); | ||
console.warn('The custom elements polyfill was reinstalled.'); | ||
} | ||
|
||
class DCOCreated extends HTMLElement { | ||
constructor() { | ||
super(); | ||
this.wasConstructed = true; | ||
} | ||
} | ||
customElements.define('dco-created', DCOCreated); | ||
</script> | ||
<script type="module"> | ||
// Safari GC bug workaround applied earlier. | ||
|
||
suite('DocumentConstructionObserver', function() { | ||
test('The DocumentConstructionObserver constructs parser-created ' + | ||
'elements in the document body.', function() { | ||
const parserCreatedElement = document.body.querySelector('dco-created'); | ||
assert(parserCreatedElement.wasConstructed); | ||
}); | ||
}); | ||
</script> | ||
</head> | ||
<body> | ||
<dco-created></dco-created> | ||
</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