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

DOMRect doesn't work in some browsers #7036

Closed
SymbolicallyMe opened this issue May 31, 2018 · 3 comments
Closed

DOMRect doesn't work in some browsers #7036

SymbolicallyMe opened this issue May 31, 2018 · 3 comments
Assignees
Labels
Framework Issues related to broader framework topics, especially as it relates to javascript [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended

Comments

@SymbolicallyMe
Copy link

SymbolicallyMe commented May 31, 2018

Describe the bug
The function/constructor DOMRect, used in dom.js (line 160), does not work in Chrome 56, IE 11 and Microsoft Edge, but works in FireFox and Safari.
screen shot 2018-05-30 at 8 08 04 pm

To Reproduce

  1. Add the Table block
  2. Open the command line
  3. Click on an empty table cell (you should get an error in the console for the browsers mentioned above).

Expected behavior
When clicking on an empty table cell within the Table block, and error should not occur.

Possible Solution
Since DOMRect works only in some browsers, a polyfill or mock DOMRect function should be created or used in place of it. TinyMCE provides it's own function to create Rectangles without issue.

import tinymce from 'tinymce';
var rectangle = tinymce.geom.Rect.create( x, y, width, height );

Screenshots
screen shot 2018-05-30 at 10 31 28 am

Relate Issues
#6666

@danielbachhuber danielbachhuber added [Type] Bug An existing feature does not function as intended [Priority] High Used to indicate top priority items that need quick attention Framework Issues related to broader framework topics, especially as it relates to javascript labels Jun 27, 2018
@danielbachhuber danielbachhuber added this to the WordPress 5.0 milestone Jun 27, 2018
@danielbachhuber
Copy link
Member

Looks like we've started progress on this, but are currently blocked: #6666 (comment)

@brandonpayton
Copy link
Member

I'll take a look at unblocking #6666 next. We submitted a DOMRect polyfill to a polyfill repository we use, but we can create a place to maintain and use them locally until they're successfully contributed to a polyfill library.

@brandonpayton
Copy link
Member

We're no longer using the DOMRect constructor in the latest @wordpress/dom package. Let's close for now and revisit if we resume use of new DOMRect().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Framework Issues related to broader framework topics, especially as it relates to javascript [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants