WordPress.org

Make WordPress Core

Opened 16 years ago

Closed 16 years ago

#1306 closed defect (bug) (wontfix)

Dict lookup regex too restrictive

Reported by: h3h Owned by:
Milestone: Priority: normal
Severity: minor Version: 1.5.1.1
Component: Administration Keywords: javasript, dictionary, regex
Focuses: Cc:

Description

On the Write Post screen, one can click the "Dict." button to get a dictionary definition for a selected word or the user will be prompted for a word to get a definition for. If the user presses Cancel in the dialog asking for a word, a new window proceeds to open to answers.com with the world "null".

I've made a simple modification that checks for a null return value from the prompt() function, in addition to a simple regex test that ensures the world is at least one word-character long.

Attachments (3)

quicktags-dict-fix-rev2.patch (495 bytes) - added by h3h 16 years ago.
quicktags-dict-fix.patch (496 bytes) - added by h3h 16 years ago.
quicktags.js-unrestrict.patch (502 bytes) - added by h3h 16 years ago.

Download all attachments as: .zip

Change History (7)

#1 @h3h
16 years ago

  • Patch set to No

#2 @h3h
16 years ago

The first patch has an extra parenthesis in it. Use rev2.

#3 @h3h
16 years ago

[\w ] was too restrictive, as it won't allow hyphenated words or words with apostrophes (and whatever else you can think up). I do think it's reasonable, however, to require the first character of the word typed to be in \w.

After application of this latest patch you can mark this issue resolved, Matt. Thanks.

#4 @h3h
16 years ago

  • Keywords javasript dictionary regex added
  • Summary changed from Dict lookup continues when cancel is pressed to Dict lookup regex too restrictive

Patch: quicktags.js-unrestrict.patch

Words such as "laissez-faire" are not allowed with the current regex. This patch makes the regex less restrictive

#5 @h3h
16 years ago

  • Version changed from 1.5.1 to 1.5.1.1

#6 @h3h
16 years ago

  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.