HTML:
<html>
<head>
<title>CAML test</title>
<style type="text/css">
csl_smiley {
-moz-binding: url("camlext.xml#csl_smiley");
border: 1px dotted black;
display: block;
width: 200px;
height: 150px;
overflow: hidden;
}
</style>
</head>
<body>
<div style="border:1px solid red;">Before</div>
<csl_smiley>Blah.</csl_smiley>
<div style="border:1px solid red;">After</div>
</body>
</html>
XBL:
<?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="csl_smiley">
<content>
<html:p>I am here</html:p>
<xul:description value="Test 1">Test.</xul:description>
</content>
</binding>
</bindings>
So far, the only thing I see is the box defined by the style (or in
case I delete everything but the -moz-binding line - nothing). Can
someone help with this?
Also, for step 2: I'd like to do all this from an extension - no
explicit declarations in the HTML, if possible. It can be done by
injecting some things into the document, but I'd really like to avoid
putting the work on the user.
Thanks in advance, Miha
An XBL binding that doesn't provide insertion points for all the
element's kids won't have its content shown. You need a <children/> in
there somewhere.
> Also, for step 2: I'd like to do all this from an extension - no
> explicit declarations in the HTML, if possible. It can be done by
> injecting some things into the document, but I'd really like to avoid
> putting the work on the user.
Use a UA stylesheet to do the binding.
-Boris
Thanks. It's finally starting to display something. But now I have a
problem with namespaces. For example, see this XHTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:caml="http://ns.example.com">
<head>
<title>CAML test</title>
<style type="text/css">
@namespace caml url("http://ns.example.com");
caml|csl_smiley {
-moz-binding: url("camlext.xml#csl_smiley");
border: 1px dotted black;
display: block;
width: 200px;
height: 150px;
overflow: hidden;
}
</style>
</head>
<body>
<div style="border:1px solid red;">Before</div>
<caml:csl_smiley> Bla text.</caml:csl_smiley>
<div style="border:1px solid red;">After</div>
</body>
</html>
Again, nothing happens. If I leave everything in a default namespace,
then it works.
> > Also, for step 2: I'd like to do all this from an extension - no
> > explicit declarations in the HTML, if possible.
>
> Use a UA stylesheet to do the binding.
Is this the way to do it (from my chrome.manifest file):
skin camlext camlskin skin/
style chrome://browser/content/browser.xul chrome://camlext/skin/camlext.css
?
Thanks and best regards, Miha
This isn't in the XHTML namespace. Are you actually loading this file
as XHTML, or are you loading it as HTML? The caml:csl_smiley business
won't do what you think in the latter case, of course.
If I load the file as XHTML and set the default namespace on the root
there to the XHTML one, it all works fine for me.
> skin camlext camlskin skin/
> style chrome://browser/content/browser.xul
chrome://camlext/skin/camlext.css
That applies your css to the web browser UI. You want to apply it to
web pages, no?
The right way to do that is using nsIStyleSheetService.
-Boris
I see I've got a lot to learn about Firefox and XHTML, since I thought
that the DOCTYPE forces the browser to use XHTML. Can you please tell
me explicitly what to do to load it as XHTML. Setting the default
namespace to XHTML I know how to do :)
>
> That applies your css to the web browser UI. You want to apply it to
> web pages, no?
>
> The right way to do that is using nsIStyleSheetService.
Thank you for the pointer. I'll look into it.
Br, Miha
The MIME type needs to be application/xhtml+xml. If this is being
loaded as a local file, not over HTTP, then the extension needs to be
.xhtml or .xht on Windows, or you need to do whatever will make the OS
MIME setup provide the right MIME type in general (extension is likely
to do it on Linux and Mac OS X; can't speak for other operating systems).
-Boris
Well, all I can say is "DOH!". I wasn't paying attention to my file
extension. Thank you, thank you, thank you!!!!
Miha
var xhtml = "http://www.w3.org/1999/xhtml";
var div = document.createElementNS(xhtml,"div");
div.setAttribute("style","border:0px solid gray");
From here:
http://userscripts.org/scripts/review/54647
This snip of code add HTML to XML like this one:
http://api.erepublik.com/v1/feeds/countries
'
I found it fun that is possible to add a HTML node to a XML tree,
...probably is possible to add XUL nodes to HTML tress, to have XUL
widgets (like <calendar> ) in html.
On Thu, Nov 26, 2009 at 10:13 AM, Mike5 <miha.vi...@gmail.com> wrote:
> Boris, thank you for all your help. I now seem to have the basic setup
> working. It's time to move on to some actual content/behavior.
> _______________________________________________
''
--
--
ℱin del ℳensaje.