Re: Regular Expressions: Inconsistent behaviours with non breaking space



RobG wrote:
[...] Thomas 'PointedEars' Lahn [...] wrote:
RobG wrote:
On Mar 25, 7:42 pm, Markus <derernst@NO#SP#AMgmx.ch> wrote:
While working on some white space trimming methods I found that the "Non
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 ECMAScript spec, Firefox and Opera are correct, but
according to the HTML 4 spec, IE and Safari are correct (see below).
Guess which one matters here ...

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.

[...]
According to the W3C HTML 4 spec, there are 5 white space characters:
The HTML 4.01 Specification is irrelevant regarding ECMAScript-defined
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
.



Relevant Pages

  • Re: Regular Expressions: Inconsistent behaviours with non breaking space
    ... breaking space" character is treated ... differently accross browsers. ... according to the HTML 4 spec, IE and Safari are correct. ... The OP mentioned white space in HTML and in javascript. ...
    (comp.lang.javascript)
  • Re: safari rendering bug: site display not correct
    ... > The problem there is not Safari, it's your HTML. ... > and you cannot reasonably expect a specific rendering. ... invalid elements and failure to close inline elements (and either ...
    (comp.sys.mac.apps)
  • Re: Eventhandler Teil von Javascript? / Frage zu Apache
    ... eben HTML und kein JavaScript ... die ECMAScript for XML erzeugt: ... ECMAScript-Implementation) als auch VBScript nativ unterstützt, ... vbAbort Xor vbRetry Xor vbIgnore Xor vbQuestion ...
    (de.comp.lang.javascript)
  • Re: Finally got my Network Uplift
    ... >> So much for the HTML. ... > reckon that in that case Safari is being excessively finicky. ... No, the explanation was, ... that safari should do mjpeg then yes, it is broken, although all ...
    (uk.comp.sys.mac)
  • Re: Sending an editable Word document as an Entourage or Outlook document
    ... Microsoft would argue that the feature "works as designed". ... Entourage makes and displays a very cut-down version of HTML, ... HTML emails are normally produced for Outlook by Microsoft Word. ... Safari will come close. ...
    (microsoft.public.mac.office.word)