New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 739417 link

Starred by 7 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Jan 16
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug-Regression



Sign in to add a comment

connectedCallback and innerHTML issue when defining a custom element in different parts of the document

Reported by mikhail....@zsassociates.com, Jul 5 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36

Steps to reproduce the problem:
connectedCallback doesn't work as expected when we put a <script> tag with definitions between two elements in the code of the page.

<my-element-1> I am custom element </my-element-1>
<script>
class myComponent1 extends HTMLElement {
	constructor() {
  		super();
  	}
  	connectedCallback() {
  		this.innerHTML += '<b>Hello!</b>';
  	}
}

customElements.define('my-element-1', myComponent1);
</script>
<br>
<my-element-1> I am custom element </my-element-1>

See more details here:
https://github.com/WebReflection/document-register-element/issues/112

What is the expected behavior?
Expect "Hello!" to be at the end of the contents of the elements regardless of where we define our custom element.

What went wrong?
Instead you can see results like.

"I am custom element Hello! 
Hello! I am custom element"

JSFiddle example with the issue: https://jsfiddle.net/webrealizer/m9qec0nv/

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 59.0.3071.115  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version:
 
Cc: brajkumar@chromium.org
Labels: -Type-Bug hasbisect-per-revision M-61 OS-Linux OS-Mac Type-Bug-Regression
Owner: dominicc@chromium.org
Status: Assigned (was: Unconfirmed)
Able to reproduce on Windows-10, Ubuntu 14.04 and Mac OS 10.12.5 using chrome latest stable M59-59.0.3071.115  .

Bisect Information:
----------------------
Good build: 57.0.2959.0 
Bad Build : 57.0.2960.0 

You are probably looking for a change made after 440365 (known good), but no later than 440366 (first known bad).

Change Log URL: 
----------------https://chromium.googlesource.com/chromium/src/+log/3af12c4aa8ef1cd694bbe9edc6798a4a8c14b226..682c7b2f1859ea71ed36201e28eb8098fd3745e2

From the above change log suspecting below change
Review URL: https://codereview.chromium.org/2592333002

dominicc@ - Could you please check whether this is caused with respect to your change, if not please help us in assigning it to the right owner.

Thanks!

Comment 2 by rakina@chromium.org, Jan 15 2018

Owner: ----
Status: Available (was: Assigned)
Bulk edit bugs owned by dominicc@
Project Member

Comment 3 by sheriffbot@chromium.org, Jan 15

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: tkent@chromium.org
Components: -Blink>HTML Blink>HTML>CustomElements
Status: WontFix (was: Untriaged)
This behavior conforms to the specification.

For the first my-element-1, it's start tag is parsed as a non-custom element and a child text node is added to it, then it is upgraded later.
For the second my-element-1, it's start tag is parsed and a custom element is instantiated, it's connected to the document, connectedCallback() is called, then child text is parsed.

Safari has the same behavior.  It seems Firefox has a bug.

Comment 6 by mikhail....@zsassociates.com, Jan 18 (5 days ago)

Looking at this case after 2 years, I can agree that it should be an expected behavior . It would also enable progressive enhancement. But it adds some challenges for developers of web components to consider such cases too.

Sign in to add a comment