Make WordPress Core

#22053 closed defect (bug) (fixed)

IE 7/8 shows a JavaScript error in editor_js()

Reported by: SergeyBiryukov Owned by: azaozz
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.5
Component: Editor Keywords: has-patch needs-testing
Focuses: Cc:


Message: Object doesn't support this property or method 
Line: 909
Char: 5
Code: 0
URI: http://trunk.wordpress/wp-admin/edit-comments.php

The line that causes this is:

el = document.getElementsByClassName('wp-editor-wrap');

Attachments (4)

patch-22053.patch (691 bytes) - added by dannydehaan 19 months ago.
Patch for ticket 22053
22053-2.diff (693 bytes) - added by CoenJacobs 19 months ago.
Fixed dannydehaan's patch, getElementByClassName should be getElementsByClassName
22053.3.diff (681 bytes) - added by SergeyBiryukov 19 months ago.
With proper formatting
22053.4.diff (753 bytes) - added by dannydehaan 19 months ago.

Download all attachments as: .zip

Change History (13)

comment:1 SergeyBiryukov19 months ago

Introduced in [22007].

comment:2 SergeyBiryukov19 months ago

To reproduce, just visit the Dashboard or Comments screen.

dannydehaan19 months ago

Patch for ticket 22053

comment:3 dannydehaan19 months ago

This is because getElementsByClassName is only available in HTML5. IE8 only partially supports HTML5, getElementsByClassName is not supported as you can see here: http://caniuse.com/#search=getelementsbyclassname. I've made a patch for this. When getElementsByClassName is available, the script will use that, otherwise it will use the fallback document.querySelectorAll('.wp-editor-wrap');

Last edited 19 months ago by dannydehaan (previous) (diff)

comment:4 SergeyBiryukov19 months ago

  • Keywords has-patch added

CoenJacobs19 months ago

Fixed dannydehaan's patch, getElementByClassName should be getElementsByClassName

comment:5 dannydehaan19 months ago

  • Keywords needs-testing added

SergeyBiryukov19 months ago

With proper formatting

comment:6 SergeyBiryukov19 months ago

  • Summary changed from IE 8 shows a JavaScript error in editor_js() to IE 7/8 shows a JavaScript error in editor_js()

22053-2.diff fixes the error in IE 8, but not in IE 7, which doesn't support querySelectorAll(): http://caniuse.com/queryselector

I also see (probably unrelated) "Error: 153 Unspecified Error" without any details on every admin screen in IE 7. Not sure how to debug that. Perhaps there's an issue with my standalone IE 7 install, however I don't remember seeing that in 3.4.

dannydehaan19 months ago

comment:7 dannydehaan19 months ago

I've made a jQuery solution so it will work in all browsers, couldn't find anything with better performance that could fix this issue. What i do see is that the editor becomes visible after clicking HTML, then back to visual, so it's not directly visible, i don't know if this should be the behaviour?

About your other "Error", i can't see it in Internet Explorer 7 or 8. I'm using a virtual machine with Windows XP and Utilu IE Collection, so it could be that.

comment:8 SergeyBiryukov18 months ago

  • Owner set to azaozz
  • Status changed from new to reviewing

comment:9 azaozz18 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

This was fixed in [22251]. Sorry, forgot to close this ticket with the commit.

Note: See TracTickets for help on using tickets.