Can you create XHTML elements in another namespace with selectors like id and class css?

I am developing an application using ubiquity-xforms. I used to serve pages as text / html with the doctrine of XHTML 1.0.

If I switched the mime type to application / xhtml + xml, I would see a pretty big performance improvement, because javascript could use the get ____ NS () functions instead of what it does now (slowly repeating the whole DOM tree every time he needs to select an item).

But when I tried this, a bunch of my CSS stopped working. I noticed that when I checked the elements, either in Firebug or in the WebKit Nightly Web Inspector, the ".classname" and "#id" css selectors for the elements in the XFORMS namespace were the point of failure. I also noticed that in the listed DOM properties for these elements they lacked the attributes "id" and "className".

My question is: is there a way to make UA recognize them as classes and identifiers?

Things I tried to no avail:

  • specifying id attributes as an identifier in the built-in ATTLIST doctype
  • try to use every type of doctrine, or not have any type of doctype at all
  • defining id and class name attributes in the xhtml namespace (i.e. xhtml: id)

Here is an xhtml example. Doesn't work in Firefox 3.5 or Safari 4 / WebKit Nightly

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  xmlns:xf="http://www.w3.org/2002/xforms">
<head>
    <style type="text/css">
    /* <![CDATA[ */
    #test {
        background-color: red;
    }
    .testing {
        color: blue;
    }
    /* ]]> */
    </style>
</head>
<body>
    <xf:group id="test" class="testing">Test</xf:group>
</body>

+5
3

,

porneL - XHTML CSS, @id a @class.

, .:)

, CSS XHTML CSS :

@namespace xf url(http://www.w3.org/2002/xforms);

xf\:input.surname, xf|input[class~="surname"] {
  color: green;
}

, IE , XHTML. , Ubiquity XForms, :

@namespace xf url(http://www.w3.org/2002/xforms);

xforms\:hint.active, xf\:hint.active {
  display: inline;
}

xf|hint[class~="active"] {
  display: inline;
}

, . ( , , . .)

:

  • HTML ':' (, '\' ) ;
  • CSS XHTML '~ =', , , .
+4

#id/.class. :

[id=test] {}
[class|=testing] {}

.

AFAIK - HTML , XML , XHTML XHTML! , , .

ID xml:id, , - .

, CSS:

@namespace xf "http://www.w3.org/2002/xforms";
xf|group {}
+1

You do not have doctype, character encoding, etc. Here you:

Change this for sure:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <!--Always include character encoding and content-type-->
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
</head>
0
source

All Articles