Opened 12 months ago
Closed 12 months ago
#21175 closed defect (bug) (invalid)
Found a bug in JavaScript program
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Editor | Version: | |
| Severity: | normal | Keywords: | |
| 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)
comment:1
ocean90
— 12 months 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
comment:2
markoheijnen
— 12 months 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
comment:3
dd32
— 12 months 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.
comment:4
markoheijnen
— 12 months 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
SergeyBiryukov
— 12 months ago
comment:5
follow-up:
↓ 6
SergeyBiryukov
— 12 months 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.
comment:6
in reply to:
↑ 5
azaozz
— 12 months 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 -.
comment:7
SergeyBiryukov
— 12 months ago
The ticket resembles #11940.
comment:8
azaozz
— 12 months 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.
comment:9
SergeyBiryukov
— 12 months ago
JSLint (comment:4) insists on both slashes :)
line 6 character 44 Unescaped '/'. line 6 character 46 Unescaped '-'.
comment:10
azaozz
— 12 months 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).
comment:11
SergeyBiryukov
— 12 months ago
Yes, that's what I've found out as well. Seems invalid then.
comment:12
azaozz
— 12 months ago
- Keywords has-patch removed
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from reopened to closed
Invalid based on the last few comments.
You should use a better editor. :)
The file is okay. Seems like your editor doesn't like the regex lines (see line 6).