Re: Regular Expressions: Inconsistent behaviours with non breaking space
- From: Thomas 'PointedEars' Lahn <PointedEars@xxxxxx>
- Date: Tue, 25 Mar 2008 14:56:34 +0100
RobG wrote:
[...] Thomas 'PointedEars' Lahn [...] wrote:
RobG wrote:
On Mar 25, 7:42 pm, Markus <derernst@NO#SP#AMgmx.ch> wrote:Guess which one matters here ...
While working on some white space trimming methods I found that the "NonAccording to the ECMAScript spec, Firefox and Opera are correct, but
breaking space" character (ASCII 160, nbsp, \u00A0) is treated
differently accross browsers. A short test shows: MSIE and Safari do
treat it as non-whitespace, FF and Opera treat it as whitespace.
according to the HTML 4 spec, IE and Safari are correct (see below).
The OP mentioned white space in HTML and in javascript. Suppling
information points out that the two specifications have different
opinions on what constitutes white space is relevant, though it may
not matter to you.
Nonsense. The OP used an ECMAScript-defined RegExp to match string input.
Whether that string input comes from a HTML DOM or from somewhere else is
entirely irrelevant regarding the behavior of the matcher. What matters is
only the used script engine that is either ECMAScript-compliant (AIUI,
section 2 does not allow JScript's and JavaScriptCore's deviation) or not.
[...]The HTML 4.01 Specification is irrelevant regarding ECMAScript-defined
According to the W3C HTML 4 spec, there are 5 white space characters:
Regular Expressions.
ECMAScript is irrelevant without a host environment. How it interacts
with, and differs from, that environment is relevant.
You must be kidding.
PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
.
- Follow-Ups:
- References:
- Regular Expressions: Inconsistent behaviours with non breaking space
- From: Markus
- Re: Regular Expressions: Inconsistent behaviours with non breaking space
- From: RobG
- Re: Regular Expressions: Inconsistent behaviours with non breaking space
- From: Thomas 'PointedEars' Lahn
- Re: Regular Expressions: Inconsistent behaviours with non breaking space
- From: RobG
- Regular Expressions: Inconsistent behaviours with non breaking space
- Prev by Date: Re: Getting list of all functions/classes/object
- Next by Date: Re: works in html form but not when in external JS file
- Previous by thread: Re: Regular Expressions: Inconsistent behaviours with non breaking space
- Next by thread: Re: Regular Expressions: Inconsistent behaviours with non breaking space
- Index(es):
Relevant Pages
|