Skip to content
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

Buggy custom element behavior when script is included before element is used #342

Closed
rorticus opened this issue May 20, 2019 · 0 comments · Fixed by #394
Closed

Buggy custom element behavior when script is included before element is used #342

rorticus opened this issue May 20, 2019 · 0 comments · Fixed by #394
Assignees

Comments

@rorticus
Copy link
Contributor

Bug

Including the <script> tag for the dojo button element before the element is referenced, as in this snippet:

<!DOCTYPE html>
<html>
<head>
	<link rel="stylesheet" href="output/dist/button-6.0.0-pre.css" />
	<script src="output/dist/button-6.0.0-pre.js"></script>
</head>
<body>
<dojo-button>Hello</dojo-button>
</body>
</html>

Will cause the text Hello to not be inserted correctly as a child element.

image

Moving the script tag to the bottom, as in:

<!DOCTYPE html>
<html>
<head>
	<link rel="stylesheet" href="output/dist/button-6.0.0-pre.css" />
</head>
<body>
<dojo-button>Hello</dojo-button>
<script src="output/dist/button-6.0.0-pre.js"></script>
</body>
</html>

Results in the proper DOM structure.

image

Package Version: 6.0.0-alpha.1

Code

I just built the @dojo/widgets custom elements and put the previously posted html file(s) in the root.

Expected behavior:

Custom elements will be initialized correctly regardless of whether or not their script has been loaded first.

Actual behavior:

Custom elements are only initialized correctly if their script is loaded after the element has been used.

@maier49 maier49 self-assigned this Jun 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants