<body id='...'>

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 18 01:48:01 PST 2015


On 2015-01-17 18:30, Andrei Alexandrescu wrote:

> Thanks! See http://goo.gl/aHeZmQ where I've added the page title as the
> ID. Sadly that doesn't work for titles that contain whitespace (quite a
> few), see
> http://stackoverflow.com/questions/5688200/can-i-use-white-spaces-in-the-name-attribute-of-an-html-element.

Stackoverflow seems to be down for the moment but no, whitespace will 
not work for this case. Because space in a CSS selector means nested 
element. This is a great resource for CSS selectors [1].

> I think we need a ddoc macro REPLACE such that e.g. $(REPLACE a, A, b,
> B, abC) yields ABC. That would also help things like ddoc -> json
> generation.

It's safer to use the URL.

> For now I guess we can implement REPLACE and fix the ID with Javascript.

Will that even work? The browser has most likely already loaded the CSS 
when the JavaScript is run. You also need to make sure the DOM is ready 
to change it.

What currently determines the URL, the name of the document? Is that 
accessible?

[1] http://www.w3schools.com/cssref/css_selectors.asp

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list