Opened 13 years ago
Closed 13 years ago
#21175 closed defect (bug) (invalid)
Found a bug in JavaScript program
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Editor | Keywords: | |
Focuses: | Cc: |
Description
Hello Sir. I found a bug in Wordpress' JavaScript Section: wp-admin/js/ folder in file word-count.js. When looking around the files of Wordpress, I opened this file in Macromedia Dreamweaver 8 and saw 90% of the code blue (I'm quite sure that something's wrong).
I didn't find any double commas. I mean, there's a single or double quote is missing there.
Attachments (1)
Change History (13)
#1
@
13 years ago
- Component changed from Formatting to General
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
- Version 3.3.2 deleted
#2
@
13 years ago
- Keywords dev-feedback added
- Milestone set to Awaiting Review
- Resolution invalid deleted
- Status changed from closed to reopened
I reopen the ticket because I would love to have a clarification about the usage of ^
in the strip regex. It seems insecure.
Also wonder the double \\
in the clean regex. Can it be that one of them was meant for the minus. This causes Dreamweaver and also Coda to make the rest blue/green
#3
@
13 years ago
The *.js files are minified, this will usually cause some applications to dispay the syntax highlighting incorrectly. Instead, you should be looking at the *.dev.js files.
#4
@
13 years ago
I did look at the dev.js file. I used http://www.jslint.com/ to find a reason why it happen and it was because of \\
in the clean regex
#5
follow-up:
↓ 6
@
13 years ago
- Component changed from General to Editor
- Keywords has-patch added
Has been this way since the script was introduced in [7854].
Looking at the clean
regex, seems that all three last characters should be escaped (21175.patch).
^
in the strip
regex seems valid considering the use case.
#6
in reply to:
↑ 5
@
13 years ago
- Keywords dev-feedback removed
Yeah, many highlighters get confused by regex patterns.
Replying to SergeyBiryukov:
Looking at the
clean
regex, seems that all three last characters should be escaped
Not necessary when inside a character set, /[\\/-]+/
matches one or more of /
, \
, and -
.
#8
@
13 years ago
Right :) Perhaps one more backslash can be added there to make it more readable and maybe make it parseable by highlighters. It wouldn't change the way it works.
#9
@
13 years ago
JSLint (comment:4) insists on both slashes :)
line 6 character 44 Unescaped '/'. line 6 character 46 Unescaped '-'.
#10
@
13 years ago
Well, JSLint is wrong here. A dash as the first or last char in a character set (a.k.a. character class) doesn't need escaping.
The "line 6 character 44 Unescaped '/'" is wrong too or the regex would throw parse error. As far as I know /[/]/
works as expected and the /
doesn't need escaping inside []
(same as a dot).
You should use a better editor. :)
The file is okay. Seems like your editor doesn't like the regex lines (see line 6).