Skip to content

Upstream the innerText spec#1678

Merged
zcorpan merged 10 commits intomasterfrom
innerText
Aug 17, 2016
Merged

Upstream the innerText spec#1678
zcorpan merged 10 commits intomasterfrom
innerText

Conversation

@zcorpan
Copy link
Copy Markdown
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
Comment thread source Outdated
<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
Copy Markdown
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.
Comment thread source Outdated
these steps:</p>

<ol>
<li><p>If the element is not <span>being rendered</span>, return the same value as the
Copy link
Copy Markdown
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.

Comment thread source Outdated
steps:</p>

<ol>
<li><p>Let <var>document</var> be the given element's <span>node document</span>.</p></li>
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread source
</div>


<h4>The <code data-x="dom-innerText">innerText</code> IDL attribute</h4>
Copy link
Copy Markdown
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
Copy Markdown
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.

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

Development

Successfully merging this pull request may close these issues.

4 participants