-
Notifications
You must be signed in to change notification settings - Fork 191
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
Bounds
must be non-empty
#856
Conversation
3a96c77
to
84c6638
Compare
* Inline `insertHTMLBefore` helper and stop exporting it (technically breaking) * Align types in signatures * Unify the handling of empty content
84c6638
to
01231a8
Compare
let first = prev ? prev.nextSibling : parent.firstChild; | ||
let last = reference ? reference.previousSibling : parent.lastChild; | ||
|
||
return new ConcreteBounds(parent, first, last); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bug (similar in nature to #852) in FastBoot. Since you don't normally run updates there I don't know how much this matters (i.e. should I split this into a BUGFIX PR and release that separately).
6118f18
to
afab947
Compare
The `Bounds` object represents a _inclusive_ range. That is, the bounds is referring to the range in DOM _including_ the `firstNode()` and the `lastNode()`. Therefore, it does not ever make sense for those endpoints to be `null`. (Technically, `(parent, null, null)` is a valid way to reprsent an _empty_ range. However, in practice we do not have a use case for this, and every use of `null` were actual bugs.) This is technically a breaking change, but then again, if `null` were passed today it's likely a bug, and if the consuming side was checking for `null` it's likely just deadcode that will never execute in practice.
afab947
to
32811df
Compare
if (parent.namespaceURI !== svgNamespace) { | ||
return super.insertHTMLBefore(parent, nextSibling, html); | ||
} | ||
|
||
return fixSVG(parent, div, html, nextSibling); | ||
// TODO: why are these casts okay??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mental model is that DOMChanges
is dealing with live elements. Updating doesn't mean anything in SSR case.
return new ConcreteBounds(_parent, comment, comment); | ||
} | ||
|
||
// TODO why are these casts okay??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize this is breaking because then interface is changing, but do we expect consumers to actual require changes to update? I don’t think Ember or Glimmer.js are manually creating these bounds objects, are they?
I don’t think so. I also removed some exports too, but I don’t know of any consumers |
On the other hand, it doesn’t cost anything to bump the minor |
This commit finishes the job iof making the SimpleDOM abstraction the full abstraction for DOM implementations in Glimmer. It adds a subset of the standard insertAdjacentHTML API to SimpleDOM, which is expected to be present in all DOM implementations provided to Glimmer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last commit lgtm
💣 contains breaking changes
The
Bounds
object represents a inclusive range. That is, the bounds is referring to the range in DOM including thefirstNode()
and thelastNode()
. Therefore, it does not ever make sense for those endpoints to benull
. (Technically,(parent, null, null)
is a valid way to represent an empty range. However, in practice we do not have a use case for this, and every use ofnull
were actual bugs.)This is technically a breaking change, but then again, if
null
were passed today it's likely a bug, and if the consuming side was checking fornull
it's likely just deadcode that will never execute in practice.