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

[BUGFIX beta] contextualElements, clean omitted start tags #5571

Closed
wants to merge 2 commits into from

Conversation

mixonic
Copy link
Sponsor Member

@mixonic mixonic commented Sep 10, 2014

During a renderTree call, look to the morphs for information about the contextualElement. Pass this to the Ember renderer, which in turn passes it to the buffer for use when generating an element.

Here I've changed the morph creation points to explicitly pass a contextualElement. This avoids the possibility of createMorph's fallback to document.body happening.

Additionally, strip omitted start tags even if the child node causing their generation is after a script tag. See the long comment in render_buffer.

Fixes #5476

if (contextualElement && contextualElement.nodeType === 1) {
contextualElements.unshift(contextualElement);
} else {
contextualElements.unshift(contextualElements[0]);
Copy link
Sponsor Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are shifted off on line 110 where it seems foolish to perform the same checks again. Instead, just push the previous contextualElement onto the stack again. Open to some cleaner ideas.

@mixonic
Copy link
Sponsor Member Author

mixonic commented Sep 10, 2014

Aiight, this stack version works, but it does not properly use the morph's existing ability to keep track of contextualElements. Hence I am repeating a bit of work that is unnecessary. Re-working after review with @krisselden

@mixonic mixonic changed the title [BUGFIX beta] A stack of contextualElements for render buffers, clean omitted start tags [BUGFIX beta] contextualElements, clean omitted start tags Sep 10, 2014
@mixonic mixonic force-pushed the contextual-element-stack branch 2 times, most recently from de11a3a to 1144b7a Compare September 10, 2014 22:11
@mixonic
Copy link
Sponsor Member Author

mixonic commented Sep 10, 2014

@krisselden ready for another review. Much cleaner. What should have been done from the get-go. Feelin' good.

@mmun
Copy link
Member

mmun commented Sep 10, 2014

Changing the RenderBuffer constructor and adding an assert is not backwards compatible. Why not just default to this.dom.document.body if no contextual element is not specified for now?

@mixonic
Copy link
Sponsor Member Author

mixonic commented Sep 10, 2014

@mmun I'll change the assert to a deprecation warning, and add a fallback to document.body, sg?

I'd like to raise some kind of notice. Anywhere the we fall back to a default context is a chance not only for an end-user to stumble and get bad data back, but also for us to introduce bugs internally.

I'll open a PR on HTMLBars for a current context accessor or something. leaking dom.document.body seems bad.

Gracias.

@mixonic
Copy link
Sponsor Member Author

mixonic commented Sep 11, 2014

updated as described.

@mixonic mixonic force-pushed the contextual-element-stack branch 5 times, most recently from 5b37fef to a55b572 Compare September 11, 2014 15:58
@wagenet
Copy link
Member

wagenet commented Sep 12, 2014

@mixonic does this need review from someone?

@mixonic
Copy link
Sponsor Member Author

mixonic commented Sep 13, 2014

I would like to get a 👍 from @krisseldon on the parent use in
renderTree. As soon as I get that this is ready to go I believe.

On 12 Sep 2014, at 17:41, Peter Wagenet wrote:

@mixonic does this need review from someone?


Reply to this email directly or view it on GitHub:
#5571 (comment)

During a renderTree call, look to the morphs for information about the
contextualElement. Pass this to the Ember renderer, which in turn passes
it to the buffer for use when generating an element.

Here I've changed the morph creation points to explicitly pass a
contextualElement. This avoids the possibility of createMorph's fallback
to document.body happening.

Additionally, strip omitted start tags even if the child node causing
their generation is after a script tag. See the long comment in
`render_buffer`.
@mixonic
Copy link
Sponsor Member Author

mixonic commented Sep 23, 2014

Closing in favor of #5609

@mixonic mixonic closed this Sep 23, 2014
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 this pull request may close these issues.

HTML tag not rendering alongside components
3 participants