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

Add child text content and its change steps #466

Merged
merged 3 commits into from Jun 27, 2017

Conversation

domenic
Copy link
Member

@domenic domenic commented Jun 15, 2017

Part of fixing whatwg/html#2752. The "child text content" concept was previously defined in HTML, but is being moved here.

Probably shouldn't merge this until the corresponding HTML PR is ready and approved, in case there are some integration issues I missed out on, but I think this is reviewable as-is.


Preview | Diff

@domenic domenic requested a review from zcorpan June 15, 2017 20:30
@domenic domenic force-pushed the child-text-content-changed branch from 5e89547 to 863e685 Compare June 15, 2017 20:33
Part of fixing whatwg/html#2752. The "child text content" concept was previously defined in HTML, but is being moved here.
@domenic domenic force-pushed the child-text-content-changed branch from 863e685 to 3d71dad Compare June 15, 2017 20:35
domenic added a commit to whatwg/html that referenced this pull request Jun 15, 2017
This fixes #2752, where it was revealed that most browsers do not care
about the textContent of a textarea, but instead about its child text
content. That is, if you use the DOM APIs to insert a child element into
the textarea element, its text does not show up for editing or as part
of the value and defaultValue properties (even though it shows up in
textContent).

This moves to a model where textareas operate entirely on the child text
content. This matches Blink and Gecko, and somewhat matches WebKit.

This also fixes #2750, by using the newly-introduced "child text content
change steps" hook introduced to DOM in
whatwg/dom#466.
@zcorpan
Copy link
Member

zcorpan commented Jun 19, 2017

I think the change in "insert" at least is wrong if node is a DocumentFragment.

@zcorpan
Copy link
Member

zcorpan commented Jun 19, 2017

Probably move the check into step 6?

@zcorpan
Copy link
Member

zcorpan commented Jun 19, 2017

I think it would be good if @annevk reviewed this also.

@zcorpan zcorpan requested a review from annevk June 19, 2017 10:33
@annevk
Copy link
Member

annevk commented Jun 22, 2017

Does normalize() need to run this or not? If not, let's add a note. (Found by searching for "for each range".)

@domenic
Copy link
Member Author

domenic commented Jun 22, 2017

Does normalize() need to run this or not? If not, let's add a note.

It should not, unless there are edge cases of normalize() that I am not aware of. My understanding is normalize() is basically figuring out the minimal set of text nodes to represent the exact same child text content, so the child text content will not change.

I'll add a note to that effect.

@annevk
Copy link
Member

annevk commented Jun 23, 2017

We should probably test that as normally even no-op changes trigger mutation records. And this is more than a no-op (although quite similar).

@domenic
Copy link
Member Author

domenic commented Jun 23, 2017

Hmm, what kind of test do you mean? For the textarea case there would be no difference between running the steps, or not. Running the steps unnecessarily just updates the API value to be itself, which is unobservable.

@annevk
Copy link
Member

annevk commented Jun 26, 2017

I guess if we don't have any endpoint where it can observed it does not matter.

@domenic domenic merged commit 93db340 into master Jun 27, 2017
@domenic domenic deleted the child-text-content-changed branch June 27, 2017 16:07
domenic added a commit to whatwg/html that referenced this pull request Jun 27, 2017
This fixes #2752, where it was revealed that most browsers do not care
about the textContent of a textarea, but instead about its child text
content. That is, if you use the DOM APIs to insert a child element into
the textarea element, its text does not show up for editing or as part
of the value and defaultValue properties (even though it shows up in
textContent).

This moves to a model where textareas operate entirely on the child text
content. This matches Blink and Gecko, and somewhat matches WebKit.

This also fixes #2750, by using the newly-introduced "child text content
change steps" hook introduced to DOM in
whatwg/dom#466.
alice pushed a commit to alice/html that referenced this pull request Jan 8, 2019
This fixes whatwg#2752, where it was revealed that most browsers do not care
about the textContent of a textarea, but instead about its child text
content. That is, if you use the DOM APIs to insert a child element into
the textarea element, its text does not show up for editing or as part
of the value and defaultValue properties (even though it shows up in
textContent).

This moves to a model where textareas operate entirely on the child text
content. This matches Blink and Gecko, and somewhat matches WebKit.

This also fixes whatwg#2750, by using the newly-introduced "child text content
change steps" hook introduced to DOM in
whatwg/dom#466.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants