Closed Bug 646002 Opened 15 years ago Closed 15 years ago

Can't match a pattern correctly on javascript

Categories

(Firefox :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 98409

People

(Reporter: sascha.mevissen, Unassigned)

Details

User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.16) Gecko/20110323 Ubuntu/10.10 (maverick) Firefox/3.6.16 Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.16) Gecko/20110323 Ubuntu/10.10 (maverick) Firefox/3.6.16 I can't do a correctly pattern-match with javascript and Mootools. Reproducible: Always Steps to Reproduce: 1.I use the Mootools-framework (1.2.4) for this function. 2.I generate a input-field like this: <input id='input3' name='passwd' type='' value='' class='required' /> 3.Then I add with mootools an patterncheck-function like this: $('input3').addEvent('keyup', function(){ var content = this.get('value'); var pattern = /["'&<>]/g; if (pattern.test(content)){ this.setStyle('background-color','red'); } else { this.setStyle('background-color','green'); } }); So if the pattern is true the input-field is colored red, else green. I've tested this function with Chrome and Opera and it works fine. With my firefox it doesn't work! Actual Results: Firefox toggles between true and false, or shows not the correct boolean value sometimes. Expected Results: It has to interprete the correct value.
The behaviour was changed in Firefox 4 to match other browsers. It should work as required without the g attribute.
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.