Discussion:
Problems with appendChildNodes?
Bjoern
2008-11-25 22:24:10 UTC
Permalink
Hello,

I am new to MochiKit and couldn't get appendChildNodes to work
properly. As an example, I tried

appendChildNodes($("idOfADiv"), SPAN({}));

but on the website this shows up as [object HTMLSpanElement] (same
with images, created with IMG), so it doesn't look as if a span dom
object is being inserted.

What am I doing wrong?

Björn

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to mochikit+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---
Yoann Aubineau
2008-11-26 09:44:38 UTC
Permalink
It seems right to me.
Could you provide us with a (non)-working example ?
Post by Bjoern
Hello,
I am new to MochiKit and couldn't get appendChildNodes to work
properly. As an example, I tried
appendChildNodes($("idOfADiv"), SPAN({}));
but on the website this shows up as [object HTMLSpanElement] (same
with images, created with IMG), so it doesn't look as if a span dom
object is being inserted.
What am I doing wrong?
Björn
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to mochikit+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~---
Bjoern
2008-11-26 10:31:13 UTC
Permalink
Thanks! This fails for me, using Firefox 3.0.4 on Ubuntu 8.10:

<?xml version="1.0" encoding="UTF-8"?>
<!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" lang="de" xml:lang="de">
<head>
<title>Mochitest</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<script src="scripts/mochikit/1.4.1/Base.js" type="application/
javascript"></script>
<script src="scripts/mochikit/1.4.1/DOM.js" type="application/
javascript"></script>
<script language="JavaScript" type="application/javascript">
function init(){
appendChildNodes("test", SPAN({}));
}

addLoadEvent(init);

</script>
</head>
<body id="body">
<h1>Mochikit Test</h1>
<div id="test">Random text... </div>
</body>
</html>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to mochikit+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---
Bob Ippolito
2008-11-26 11:12:30 UTC
Permalink
It looks like you also need Iter.js after Base.js and before DOM.js in
order for that to work properly. Not entirely sure why without looking
deeper into it, but I think that's a bug.
Post by Bjoern
<?xml version="1.0" encoding="UTF-8"?>
<!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" lang="de" xml:lang="de">
<head>
<title>Mochitest</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<script src="scripts/mochikit/1.4.1/Base.js" type="application/
javascript"></script>
<script src="scripts/mochikit/1.4.1/DOM.js" type="application/
javascript"></script>
<script language="JavaScript" type="application/javascript">
function init(){
appendChildNodes("test", SPAN({}));
}
addLoadEvent(init);
</script>
</head>
<body id="body">
<h1>Mochikit Test</h1>
<div id="test">Random text... </div>
</body>
</html>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to mochikit+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---
Bjoern
2008-11-26 11:20:05 UTC
Permalink
Fantastic, thanks! It works now.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to mochikit+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---
Per Cederberg
2008-11-26 14:00:37 UTC
Permalink
Confirmed. I created a new ticket for this:

http://trac.mochikit.com/ticket/328

I'll fix this one too in 1.4.2, which should be ready this week.

Cheers,

/Per
Post by Bob Ippolito
It looks like you also need Iter.js after Base.js and before DOM.js in
order for that to work properly. Not entirely sure why without looking
deeper into it, but I think that's a bug.
Post by Bjoern
<?xml version="1.0" encoding="UTF-8"?>
<!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" lang="de" xml:lang="de">
<head>
<title>Mochitest</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<script src="scripts/mochikit/1.4.1/Base.js" type="application/
javascript"></script>
<script src="scripts/mochikit/1.4.1/DOM.js" type="application/
javascript"></script>
<script language="JavaScript" type="application/javascript">
function init(){
appendChildNodes("test", SPAN({}));
}
addLoadEvent(init);
</script>
</head>
<body id="body">
<h1>Mochikit Test</h1>
<div id="test">Random text... </div>
</body>
</html>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to mochikit+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Bob Ippolito
2008-11-26 10:24:35 UTC
Permalink
Are you adding SPAN({}) to a string or something?

appendChildNodes("idOfADiv", SPAN({})) should insert an empty SPAN,
but appendChildNodes("idOfADiv", SPAN({}) + "") might have the
behavior that you're describing. You want to use commas, not addition
to add multiple nodes, e.g. appendChildNodes("idOfADiv", SPAN({}),
"text", DIV({}))

Using $() is not necessary because any function that expects a DOM
node will automatically do the getElement for you.
Post by Bjoern
Hello,
I am new to MochiKit and couldn't get appendChildNodes to work
properly. As an example, I tried
appendChildNodes($("idOfADiv"), SPAN({}));
but on the website this shows up as [object HTMLSpanElement] (same
with images, created with IMG), so it doesn't look as if a span dom
object is being inserted.
What am I doing wrong?
Björn
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to mochikit+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~-----
Loading...