Bug 16639 - Acid3 expects className to preserve whitespace when setting
Summary: Acid3 expects className to preserve whitespace when setting
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Darin Adler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-28 02:08 PST by Eric Seidel (no email)
Modified: 2008-01-01 05:55 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2007-12-28 02:08:35 PST
Acid3 excpects className to preserve whitespace when setting

We fail this section:
      p.className = p.className.replace(/ /, '\n');
      if (!p.hasAttribute('class') ||
          p.getAttribute('class') != '\nte\n\nst\n' ||
          p.className != '\nte\n\nst\n')

of the following test:

    function () {
      // test 51: className and the class attribute: space preservation
      var ok = true;
      var p = document.createElement('p');
      if (p.hasAttribute('class'))
        ok = false;
      p.setAttribute('class', ' te  st ');
      if (!p.hasAttribute('class') ||
          p.getAttribute('class') != ' te  st ' ||
          p.className != ' te  st ')
        ok = false;
      p.className = p.className.replace(/ /, '\n');
      if (!p.hasAttribute('class') ||
          p.getAttribute('class') != '\nte\n\nst\n' ||
          p.className != '\nte\n\nst\n')
        ok = false;
      p.className = '';
      if (!p.hasAttribute('class') ||
          p.getAttribute('class') != '' ||
          p.className != '')
        ok = false;
      if (ok)
        return 4;
    },

I'm not sure what spec supports preserving whitespace like that (or what other browsers do).
Comment 1 Darin Adler 2007-12-31 16:11:59 PST
There's no reason the attribute value should have any whitespace processing done on it. I don't understand why the whitespace is changing.
Comment 2 Darin Adler 2007-12-31 16:23:10 PST
This is a bug in Acid3.

Presumably Hixie means to include a "g" like this:

      p.className = p.className.replace(/ /g, '\n');
Comment 3 Eric Seidel (no email) 2007-12-31 18:25:11 PST
Adding Ian to make sure he saw this was a bug in Acid3.
Comment 4 Darin Adler 2007-12-31 18:36:20 PST
No need. He sees all. (Seriously, he's cc'd on all WebKit bugs.)
Comment 5 Ian 'Hixie' Hickson 2008-01-01 05:55:05 PST
oops. fixed. good catch.

cc'ing me explicitly is a good way to catch my attention, by the way. Though I do watch many people, I don't guarantee that I'll see all bugmail, especially if I'm not explicitly cc'ed.