Skip to content

fix(aio): switch from innerText to textContent to support older browsers - #17598

Merged
hansl merged 1 commit into
angular:masterfrom
gkalpak:fix-aio-firefox-44
Jun 19, 2017
Merged

hansl merged 1 commit into
angular:masterfrom
gkalpak:fix-aio-firefox-44

Conversation

@gkalpak

@gkalpak gkalpak commented Jun 18, 2017 •

Copy link
Copy Markdown
Member

innerText is not supported in Firefox prior to v45. In most cases (at least the ones we are interested in), innerText and textContent work equally well, but textContent is more performant (as it doesn't require a reflow).

From MDN on the differences of innerText vs textContent:

  • [...]
  • innerText is aware of style and will not return the text of hidden elements, whereas textContent will.
  • As innerText is aware of CSS styling, it will trigger a reflow, whereas textContent will not.
  • [...]

Fixes #17585.

@mary-poppins

Copy link
Copy Markdown

The angular.io preview for ed8e614183b1d549cc8d8f617de0d5d0c08aca56 is available here.

@mary-poppins

Copy link
Copy Markdown

The angular.io preview for 44c1d08b1c0a048f8d95e1c26c94031efd30dd5d is available here.

@gkalpak gkalpak mentioned this pull request Jun 18, 2017
1 of 8 tasks
@gkalpak gkalpak added action: review The PR is still awaiting reviews from at least one requested reviewer and removed state: WIP labels Jun 18, 2017
@petebacondarwin petebacondarwin added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jun 19, 2017
…rowsers

`innerText` is not supported in Firefox prior to v45. In most cases (at least
the ones we are interested in), `innerText` and `textContent` work equally well,
but `textContent` is more performant (as it doesn't require a reflow).

From [MDN][1] on the differences of `innerText` vs `textContent`:

> - [...]
> - `innerText` is aware of style and will not return the text of hidden
>   elements, whereas `textContent` will.
> - As `innerText` is aware of CSS styling, it will trigger a reflow, whereas
>   `textContent` will not.
> - [...]

[1]: https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent#Differences_from_innerText

Fixes angular#17585
@gkalpak
gkalpak force-pushed the fix-aio-firefox-44 branch from 44c1d08 to 237480e Compare June 19, 2017 10:07
@mary-poppins

Copy link
Copy Markdown

The angular.io preview for 237480e is available here.

@hansl
hansl merged commit 4f37f86 into angular:master Jun 19, 2017
@gkalpak
gkalpak deleted the fix-aio-firefox-44 branch June 19, 2017 19:27
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Sep 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation is broken in Firefox

5 participants