Re: [jQuery] Can the content of a node of xml be placed inside a div when xml source is loaded using .get

2006-08-26 Thread Sam Sherlock





when I use $("#main").append( $("main",xml).children() );

I get the following:

[Exception... "Could not convert _javascript_ argument arg 0
[nsIDOMHTMLDivElement.appendChild]" nsresult: "0x80570009
(NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame ::
http://ss29/_work/sharkevader.com/v2/assets/js/jquery-1.0.pack.js ::
anonymous :: line 9" data: no]

the other suggested approach 

puts the data in but removes alot of the formating and disables links -
quite odd not something I expected

any suggests




John Resig wrote:

  Sam -

Try doing this:
$("main",xml).children().appendTo("#main");

or this:
$("#main").append( $("main",xml).children() );

I think they may get you the effect that you desire. This is with the
(soon to be) jQuery 1.0:
http://jquery.com/src/jquery-svn.js

--John

On 8/25/06, Sam Sherlock [EMAIL PROTECTED] wrote:
  
  
.text works if you put the HTML in cdata.

though I have some odd display issues, or am I still going wrong??


On 8/26/06, Sam Sherlock  [EMAIL PROTECTED] wrote:


  I have tried that but no joy, when I dump the mark up to the console

var newContent = "";
...
console.info('main from xml source: ' + newContent);


main from xml source: undefined

what am I doing wrong??




On 8/26/06, Jonathan Howard  [EMAIL PROTECTED] wrote:
  
  

Try:

$("main",xml).html()

instead of:

$("main",xml).text()



On 8/25/06, Sam Sherlock  [EMAIL PROTECTED] wrote:


the dynamic xml source creates a structure along the following lines

content
   titlemy title/title
   main
   pabout/p
   /main
   script

   /script
/content


the jquery code that I am using to take load the xml source and take the
content




  

$.get("./content/?id="+htmlDoc,function(xml){


  
   var innerHeight = 0;

   // however this return the text stripped of mark up
   alert( $("main",xml).text() );

   //  i need to retain the mark and place it in my
main div


  

$("div#main").html($("main",xml).text());


  
   innerHeight =
document.getElementById('innerMain').offsetHeight;

   $("div#main").css({height: innerHeight+"px"});
   $("div#content").css({height: innerHeight+"px"});

   //

  

$("div#main").slideDown("slow");


  
   //console.info("new height " + innerHeight);
   init();
   });


is there a way to do this??

  

  
  
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

  




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Can the content of a node of xml be placed inside a div when xml source is loaded using .get

2006-08-26 Thread Dave Methvin
 $(#main).append( $(main,xml).children() );
  [Exception... Could not convert JavaScript argument arg 0  
  [nsIDOMHTMLDivElement.appendChild] nsresult: 0x80570009 
  (NS_ERROR_XPC_BAD_CONVERT_JS)  
 
I've seen that error in Firefox if you try to append a null or undefined
using appendChild. 
 


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Can the content of a node of xml be placed inside a div when xml source is loaded using .get

2006-08-25 Thread Jonathan Howard
Try:

$(main,xml).html() 

instead of:

$(main,xml).text() 
On 8/25/06, Sam Sherlock [EMAIL PROTECTED] wrote:
the dynamic xml source creates a structure along the following linescontent titlemy title/title
 main pabout/p /main script /script/contentthe jquery code that I am using to take load the xml source and take the
content $.get(./content/?id=+htmlDoc,function(xml){ var innerHeight = 0; // however this return the text stripped of mark up
 alert( $(main,xml).text() ); //i need to retain the mark and place it in mymain div $(div#main).html($(main,xml).text());
 innerHeight =document.getElementById('innerMain').offsetHeight; $(div#main).css({height: innerHeight+px}); $(div#content).css({height: innerHeight+px});
 //$(div#main).slideDown(slow); //console.info(new height  + innerHeight); init(); });
is there a way to do this??___jQuery mailing listdiscuss@jquery.comhttp://jquery.com/discuss/

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Can the content of a node of xml be placed inside a div when xml source is loaded using .get

2006-08-25 Thread Sam Sherlock
.text works if you put the HTML in cdata.though I have some odd display issues, or am I still going wrong??On 8/26/06, Sam Sherlock 
[EMAIL PROTECTED] wrote:I have tried that but no joy, when I dump the mark up to the console
var newContent = ;...console.info(' main from xml source: ' + newContent); main from xml source: undefined
what am I doing wrong??On 8/26/06, Jonathan Howard 
[EMAIL PROTECTED] wrote:
Try:

$(main,xml).html() 

instead of:

$(main,xml).text() 
On 8/25/06, Sam Sherlock 

[EMAIL PROTECTED] wrote:
the dynamic xml source creates a structure along the following lines
content titlemy title/title
 main pabout/p /main script /script/contentthe jquery code that I am using to take load the xml source and take the
content $.get(./content/?id=+htmlDoc,function(xml){ var innerHeight = 0; // however this return the text stripped of mark up


 alert( $(main,xml).text() ); //i need to retain the mark and place it in mymain div $(div#main).html($(main,xml).text());
 innerHeight =document.getElementById('innerMain').offsetHeight; $(div#main).css({height: innerHeight+px}); $(div#content).css({height: innerHeight+px});
 //$(div#main).slideDown(slow); //console.info(new height  + innerHeight); init(); });
is there a way to do this??___jQuery mailing list

discuss@jquery.comhttp://jquery.com/discuss/


___jQuery mailing listdiscuss@jquery.com

http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Can the content of a node of xml be placed inside a div when xml source is loaded using .get

2006-08-25 Thread John Resig
Sam -

Try doing this:
$(main,xml).children().appendTo(#main);

or this:
$(#main).append( $(main,xml).children() );

I think they may get you the effect that you desire. This is with the
(soon to be) jQuery 1.0:
http://jquery.com/src/jquery-svn.js

--John

On 8/25/06, Sam Sherlock [EMAIL PROTECTED] wrote:
 .text works if you put the HTML in cdata.

 though I have some odd display issues, or am I still going wrong??


 On 8/26/06, Sam Sherlock  [EMAIL PROTECTED] wrote:
 
  I have tried that but no joy, when I dump the mark up to the console
 
  var newContent = ;
  ...
  console.info('main from xml source: ' + newContent);
 
 
  main from xml source: undefined
 
  what am I doing wrong??
 
 
 
 
  On 8/26/06, Jonathan Howard  [EMAIL PROTECTED] wrote:
  
  
   Try:
  
   $(main,xml).html()
  
   instead of:
  
   $(main,xml).text()
  
  
  
   On 8/25/06, Sam Sherlock  [EMAIL PROTECTED] wrote:
  
   
  
   the dynamic xml source creates a structure along the following lines
  
   content
  titlemy title/title
  main
  pabout/p
  /main
  script
  
  /script
   /content
  
  
   the jquery code that I am using to take load the xml source and take the
   content
  
  
  
 $.get(./content/?id=+htmlDoc,function(xml){
  
  var innerHeight = 0;
  
  // however this return the text stripped of mark up
  alert( $(main,xml).text() );
  
  //  i need to retain the mark and place it in my
   main div
  
 $(div#main).html($(main,xml).text());
  
  innerHeight =
   document.getElementById('innerMain').offsetHeight;
  
  $(div#main).css({height: innerHeight+px});
  $(div#content).css({height: innerHeight+px});
  
  //
 $(div#main).slideDown(slow);
  
  //console.info(new height  + innerHeight);
  init();
  });
  
  
   is there a way to do this??

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/