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

Upstream the innerText spec #1678

Merged
merged 10 commits into from
Aug 17, 2016
Merged

Upstream the innerText spec #1678

merged 10 commits into from
Aug 17, 2016

Conversation

zcorpan
Copy link
Member

@zcorpan zcorpan commented Aug 16, 2016

From https://rocallahan.github.io/innerText-spec/ with no normative
changes except adding [CEReactions] to the IDL.

Fixes #465.


@Ms2ger @rocallahan

From https://rocallahan.github.io/innerText-spec/ with no normative
changes except adding [CEReactions] to the IDL.

Fixes #465.
@zcorpan zcorpan added addition/proposal New features or enhancements compat Standard is not web compatible or proprietary feature needs standardizing labels Aug 16, 2016
@zcorpan zcorpan mentioned this pull request Aug 16, 2016
14 tasks
<code>select</code>, and <code>video</code> &mdash; but not <code>button</code>) are not rendered
by CSS, strictly speaking, and therefore have no CSS boxes for the purposes of this algorithm.</p>

<p class="big-issue">This algorithm is amenable to being generalized to work on a <span
Copy link
Member

Choose a reason for hiding this comment

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

"a ranges" -> "a range" | "ranges"

This matches WebKit/Chromium but not Gecko/IE. Treating null as
empty string is consistent with textContent and innerHTML.
these steps:</p>

<ol>
<li><p>If the element is not <span>being rendered</span>, return the same value as the
Copy link
Member

Choose a reason for hiding this comment

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

@domenic and I started using "this element" (or equivalent) in other algorithms. I think that would be a clearer way to refer to the object on which the IDL attribute is defined.

steps:</p>

<ol>
<li><p>Let <var>document</var> be the given element's <span>node document</span>.</p></li>
Copy link
Member

Choose a reason for hiding this comment

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

this element's

@annevk
Copy link
Member

annevk commented Aug 17, 2016

This looks okay. The only thing I'd consider changing further is making the recursion less declarative. Have that be some algorithm that is invoked for each child and also put the result in a variable of some kind the rest of the algorithm uses. Will let @domenic make the call on that.

@zcorpan
Copy link
Member Author

zcorpan commented Aug 17, 2016

Yeah, it could use some more cleanup. Possibly also switch to iterative traversal instead of recursive? But I think the current state is OK to merge and I can fix more later.

@@ -11962,6 +11974,175 @@ interface <dfn>DOMStringMap</dfn> {
</div>


<h4>The <code data-x="dom-innerText">innerText</code> IDL attribute</h4>
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if a better title might be something like Manipulating an element's "as rendered" text? It seems to me like other section titles usually don't talk about a specific IDL attribute. I don't feel strongly though.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a bit of a mix currently. Having "innerText" in the heading makes it easier to find. But if we also add outerText we can maybe change the heading at that point.

list of items.</p></li>

<li><p>If <var>node</var>'s <span>computed value</span> of <span>'visibility'</span> is not
'visible', then return <var>items</var>.</p></li>
Copy link
Member

Choose a reason for hiding this comment

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

I guess this is the same concern as the factoring thing @annevk mentioned, but saying "return" inside a getter and that not being the result of the getter is pretty confusing. "Let the result of these substeps be items and abort these substeps"? Meh...

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah... I went with your suggestion for now but it's not great.

@domenic
Copy link
Member

domenic commented Aug 17, 2016

LGTM. I think the original commit message is a bit outdated so I'll let you merge and write up a commit message. Also probably want to reference #1679

@zcorpan zcorpan merged commit 132a55e into master Aug 17, 2016
@zcorpan zcorpan deleted the innerText branch August 17, 2016 21:04
@smaug----
Copy link

I assume there will be tests for this in wpt.

zcorpan added a commit to web-platform-tests/wpt that referenced this pull request Aug 18, 2016
Ms2ger pushed a commit to web-platform-tests/wpt that referenced this pull request Aug 18, 2016
@zcorpan
Copy link
Member Author

zcorpan commented Aug 19, 2016

@smaug---- there were tests in wpt already, and I have submitted these PRs to update them so far:
web-platform-tests/wpt#3482 (merged)
web-platform-tests/wpt#3483 (merged)
web-platform-tests/wpt#3491
web-platform-tests/wpt#3492
web-platform-tests/wpt#3493

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements compat Standard is not web compatible or proprietary feature needs standardizing
4 participants