Re: Create CSSStyleDeclaration object

Mike5 <[email protected]>
Newsgroups gmane.comp.mozilla.devel.dom
Organization http://groups.google.com
Message-ID <13c9d253-bd34-4ca3-9925-c4ddf4cbb80f@j14g2000yqm.googlegroups.com>
On Nov 27, 9:00 pm, Boris Zbarsky <[email protected]> wrote:
> On 11/27/09 4:11 AM, Mike5 wrote:
>
> > Background:
> > Because of the apparent Firefox bug with XHTML and tag character case,
> > I have a problem with binding XBL to tags. E.g.:
>
> > Works:
> > CSS: ns|customtag { style... }
> > XHTML:<ns:customtag>
>
> > Doesn't work:
> > CSS: ns|customTag { style... }
> > XHTML:<ns:customTag>
>
> > (!!!note the capital "T"!!!)
>
> This should work fine in an XHTML document.  Can you point to your testcase?

Ok, I have finally completely tested it, and this is the way it goes:

if I load my stylesheet from extension, then it does not work for
camelCase:
chrome/content/camlext.js:
---
var CAMLExt_sss = Components.classes["@mozilla.org/content/style-sheet-
service;1"]
                    .getService
(Components.interfaces.nsIStyleSheetService);
var CAMLExt_ios = Components.classes["@mozilla.org/network/io-service;
1"]
                    .getService(Components.interfaces.nsIIOService);
var CAMLExt_uri = CAMLExt_ios.newURI("chrome://camlext/content/
camlext.css", null, null);
CAMLExt_sss.loadAndRegisterSheet(CAMLExt_uri, CAMLExt_sss.USER_SHEET);
---

chrome/content/camlext.css:
---
@namespace camlns url("http://ns.example.com");

camlns|xyChart {
        -moz-binding: url("camlext.xml#xyChart");
	border: 1px dotted black;
	display: inline-block;
	width: 200px;
	height: 150px;
	overflow: hidden;
}
---

chrome/content/camlext.xul:
---
<?xml version="1.0"?>
<!DOCTYPE overlay SYSTEM "chrome://camlext/locale/CAMLExt.dtd" >

<overlay id="camlext"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/
there.is.only.xul">
 <script src="camlext.js" />

</overlay>
---

chrome/content/camlext.xml:
---
<?xml version="1.0"?>
<bindings xmlns="http://www.mozilla.org/xbl"
         xmlns:html="http://www.w3.org/1999/xhtml"
         xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/
there.is.only.xul">
  <binding id="xyChart">
    <content>
      <xul:hbox context="chartContext">
       <xul:description value="X-Y chart" />
       <html:br />
       <html:span style="color:#d0d0d0;">
        <children />
       </html:span>
      </xul:hbox>
    </content>
  </binding>
</bindings>
---

*Working*!!!! from xhtml (I see the box):
---
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:caml="http://
ns.example.com">
<head>
	<title>CAML test</title>
</head>
<body>
	<div style="border:1px solid red;">Before</div>
	text before
	<caml:xychart attr1="ena"></caml:xychart>
	text after
	<div style="border:1px solid red;">After</div>
</body>
</html>
---

*NOT working*!!!! from xhtml (I don't see the box):
---
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:caml="http://
ns.example.com">
<head>
	<title>CAML test</title>
</head>
<body>
	<div style="border:1px solid red;">Before</div>
	text before
	<caml:xyChart attr1="ena"></caml:xyChart>
	text after
	<div style="border:1px solid red;">After</div>
</body>
</html>
---

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * *

If I create two local files, like this:
test.css:
---
@namespace ns2 url("http://webca.cosylab.com");
ns2|xyChart { border: 1px dotted red; display: block;}
---

text.xhtml:
---
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:caml="http://
webca.cosylab.com">
<head>
<title>Title</title>
<link type="text/css" href="test.css" rel="stylesheet" />
</head>

<body>
<p>Paragraph.</p>

<caml:xyChart>special element.</caml:xyChart>
</body>

</html>
---


Then the tags must match in case exactly.

Miha.
_______________________________________________
dev-tech-dom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-dom
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.