Re: [selectors] Anonymous Attribute Selector

Tab Atkins Jr. <jackalmage@gmail.com> @ 2014-06-02:
> 
> Once again, though, you do *not* need to select an "anonymous"
> attribute.  You just need to specify that your single unnamed
> attribute maps to an attribute of a particular name in DOM.  The only
> reason you have trouble here is because you're trying to lean on
> HTML's parsing rules to parse a non-HTML language that makes different
> assumptions about some things (namely, the syntax of attributes).  Fix
> that and your CSS problem goes away.
> 
> …
> 
> Just like your example, BBCode needs to define a mapping into DOM if
> it expects to be matched by CSS, which means defining a name for the
> attribute of the [url] tag.
> 
> To reiterate - I don't see a use-case for an unnamed attribute here.
> Selectors is based on the DOM, and you're defining your own markup
> language, so you can define how it maps into a DOM.  In particular,
> you can define a name for your attribute for the purpose of Selectors
> and the DOM, even if that name is never written or referenced within
> your markup language.  I strongly oppose complicating the Selectors
> syntax and data model to address this when it's so trivial to address
> it on the host language side.

I thought about this and apparently what I really need – and Selectors doesn’t do – is a generic syntax description language to map from marked up text (not XML or HTML) to the DOM. 

SGML could probably do such a thing for most languages, e.g. <http://www.xml.com/2004/03/03/examples/wiki.sgm> for a random wiki markup language. Other languages like XSD, DSD, Schematron and Relax NG are tailored and limited to XML, as far as I know.

Every text editor with syntax highlighting needs a language like that if it doesn’t hard-code regular expressions. The difference may be that there’s a closed set of styleable, semantic elements that matches are mapped to.

Received on Wednesday, 25 June 2014 12:41:38 UTC