Opened 8 years ago
Closed 8 years ago
#38000 closed defect (bug) (fixed)
Visual mode editor is broken after update to 4.6.1
Reported by: | arnolem | Owned by: | azaozz |
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | minor | Version: | 4.6.1 |
Component: | Editor | Keywords: | has-patch |
Focuses: | javascript, administration | Cc: |
Description (last modified by )
The comment javascript was added in [38349] breaks the javascript code if it is minified :
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-wp-editor.php#L1260
See attach for more information.
the patch is attached.
Attachments (3)
Change History (11)
#1
@
8 years ago
- Keywords has-patch added
- Milestone changed from Awaiting Review to 4.6.2
Good catch, thanks!
I think this should be fixed in 4.6.2.
#2
follow-up:
↓ 3
@
8 years ago
- Description modified (diff)
@arnolem Welcome to Trac and thanks for your report!
What are you using to minify the HTML in the admin?
#3
in reply to:
↑ 2
;
follow-up:
↓ 4
@
8 years ago
Replying to ocean90:
@arnolem Welcome to Trac and thanks for your report!
What are you using to minify the HTML in the admin?
Thanks !
I have a simple PHP function to minify all HTML elements in function.php
You can see an example here :
http://stackoverflow.com/questions/6225351/how-to-minify-php-page-html-output#answer-6225706
You can rewrite it more simple
<?php ob_start(function ($buffer) { return preg_replace([ '/\>[^\S ]+/s', // strip whitespaces after tags, except space '/[^\S ]+\</s', // strip whitespaces before tags, except space '/(\s)+/s' // shorten multiple whitespace sequences ], ['>','<','\\1'], $buffer); });
#4
in reply to:
↑ 3
@
8 years ago
Replying to arnolem:
I have a simple PHP function to minify all HTML elements in function.php
I'm afraid this preg_replace() is not "up for the job". As mentioned in the comments at the link you posted, it will potentially break anything in a <script>
, <pre>
and <textarea>
tags. There are probably better "HTML white space removers" you could use.
Of course we will fix the comment style in this inline JS, but you will probably run into more problems in the future.
#5
@
8 years ago
- Milestone changed from 4.6.2 to 4.7
- Severity changed from normal to minor
Might as well be a wontfix, but changing the milestone as there's a patch for changing the comment.
#6
@
8 years ago
@azaozz What's your opinion on this? Leaning towards wontfix, but on the other hand it would be such a minor change.
JS Error