-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Blocks: Raw Handling: Find closest PRE by stepping through parents #21366
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aduth
added
[Type] Bug
An existing feature does not function as intended
[Feature] Paste
Browser Issues
Issues or PRs that are related to browser specific problems
[Package] Blocks
/packages/blocks
labels
Apr 2, 2020
Size Change: +1.31 kB (0%) Total Size: 885 kB
ℹ️ View Unchanged
|
Can confirm pasting in IE11 works properly with this change. Also tested in Chromium and Firefox on win10. |
azaozz
approved these changes
Apr 2, 2020
A bit of a struggle to coerce JSDOM to intentionally be non-spec-compliant, but I succeeded in creating a test case in 63d1c4b. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Browser Issues
Issues or PRs that are related to browser specific problems
[Feature] Paste
[Package] Blocks
/packages/blocks
[Type] Bug
An existing feature does not function as intended
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #21276 (comment)
This pull request seeks to resolve an error which occurs when pasting text in a RichText field (e.g. paragraph) in Internet Explorer.
As noted by @azaozz at #21276 (comment) , the issue stems from the fact that
Node#parentElement
is not reliably available in Internet Explorer, depending on the node type.Implementation Notes:
The changes here address this issue by replacing
Element#closest
with a basicwhile
loop to step through the ancestry. WhileElement#closest
didn't need to be removed, it would still have required at least parts of an implementation like this in order to iterate to the closest element, so I opted to use this as the primary method to get to the closest enclosing<pre>
tag.Testing Instructions:
Repeat Steps to Reproduce from #21276 (comment), verifying that pasting text in Internet Explorer succeeds without error.
Note: While pasting does now succeed, there appear to be related bugs with regards to selection placement after the paste. The selection range will incorrectly move to the end of the paragraph text.