Hi Kumar,

> I dont want to just see the DOM source, but indeed want to
> use. It was part of design to use it.

With respect, please go back and re-read the relies above.  The point
that Walter and I and Bill are making is you *can* use the new
elements; it's just "View Source" (the UI feature that lets you see
the *original* document the server sent) that doesn't do what you
expected.  But that's fine; your users won't be using "View Source."
If you stop doing "View Source" and just write code to the DOM API
(which is all you *can* write code to in this respect), you'll find
your elements there and waiting.

Walter gave you an example.  Here's another one:  Assume a document
containing a div with the ID "fred" which is empty when the page first
shows up in the browser, and so:

    alert($('fred').childElements().length);
    // -> Alerts 0...

...because 'fred' is empty.  Now, suppose I update 'fred's contents:

    $('fred').update("<p>one</p><p>two</p><p>three</p>");

Now, 'fred' has three direct children (the three paragraphs I just
added):

    alert($('fred').childElements().length);
    // Alerts 3

...and yet if you do "view source", 'fred' is empty -- as Walter said,
"view source" shows you the source that was delivered from the server,
*NOT* the current state of the DOM and what's being displayed.  That's
fine, "view source" is completely irrelevant to runtime stuff.  The
elements are in the DOM and you *can* use them, your issue is purely a
tools issue -- you're using the wrong tools to look at the *current*
state of the DOM.

I don't know if the IE developer toolbar offers a way to browse the
current state of the DOM; I'd expect the up-to-date stuff to offer
that feature.  In the non-IE world, again, Firefox with Firebug
certainly does, as does Chrome's "inspect element" feature.

HTH,
--
T.J. Crowder
tj / crowder software / com
www.crowdersoftware.com


On Sep 21, 5:57 pm, Kumar <kumar.k.re...@gmail.com> wrote:
> Thanks Bill. I am already using IE Developer Toolbar with Internet
> Explorer. I dont want to just see the DOM source, but indeed want to
> use. It was part of design to use it. Thanks for your reponse though.
>
> Thanks
>
> On Sep 21, 11:38 am, bill <will...@techservsys.com> wrote:
>
>
>
> > Kumar wrote:
> > > Hi Walter -
>
> > > I completely understood what you meant. I have a strange situation
> > > here. My enitre design sits on top of the DOM for lateral processing.
> > > As soon as the DOM gets updated, there will be sequence of java script
> > > calls based on the elements generated on this DOM for form processing.
> > > After I heard that I cannot get the DOM state at the source code
> > > level, I will probably take a look at other design issue. This is
> > > something I never expected...
>
> > You can look at the dom source code as it exists at any point in time,
> > just not by clicking "view source."  As was pointed out below, Firefox +
> > Firebug gives you a elegantly laid out picture (in source) of the dom.
>
> > > Thanks
>
> > > On Sep 21, 9:48 am, Walter Lee Davis <wa...@wdstudio.com> wrote:
>
> > >> There's a fundamental difference between the source code and the  
> > >> current state of the DOM. The former is fixed at the time that your  
> > >> server sends it. And once that source is sent to the browser, the  
> > >> browser interprets it and generates the DOM, which it uses to create  
> > >> the on-screen display of the **current** state of the DOM.
>
> > >> Anything you do later to modify the DOM causes the DOM itself to  
> > >> change, and thus the screen to update, but does not update the source  
> > >> you see in your browser. Think of the source as the score, and the DOM  
> > >> as the orchestral performance. The conductor and orchestra is  
> > >> JavaScript, then, to stretch the metaphor.
>
> > >> When you request an element by its ID, you are "asking" the DOM, not  
> > >> the source. When you modify an element on screen, or update it to  
> > >> contain entirely new content, you are modifying the DOM, not the page  
> > >> source.
>
> > >> HTML:
> > >> <div id="foo">something here</div>
>
> > >> JavaScript:
> > >> $('foo').addClassName('bar');
> > >> console.log($('foo').hasClassName('bar')) //=> true
>
> > >> $$('.bar').invoke('insert',' with classname bar');
> > >> console.log($('foo').innerHTML) //=> something here with classname bar
>
> > >> At no point above, if you looked in the source, would you see that  
> > >> #foo now was #foo.bar, or that its content had changed, unless you  
> > >> were using a tool such as Firebug to inspect the current state of the  
> > >> DOM.
>
> > >> Walter
>
> > >> On Sep 21, 2009, at 9:22 AM, Kumar wrote:
>
> > >>> Hi Tj -
>
> > >>> Thanks for the prompt response. It really amazed me, when I heard that
> > >>> I can see source code of the original document and not the later
> > >>> things that got updated through the Ajax updater. We have this
> > >>> dependency where we need to make series of Java script calls based on
> > >>> the dynamic response created by the Ajax updater. That includes the
> > >>> dynamically generated element id's and stuff. If these are not going
> > >>> to be visible in generated source, how am I supposed to make
> > >>> advantage. Is there a way, though prorotype Ajax ?
>
> > >>> Thanks
>
> > >>> On Sep 19, 8:21 am, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
>
> > >>>> Hi,
>
> > >>>> "View source" will only show you the original source of the document,
> > >>>> not any later modifications you make to the DOM (e.g., via
> > >>>> Ajax.Updater or any of several other means).  Why does it matter?
> > >>>> What is it you're trying to achieve looking at the source?  If it's
> > >>>> just that you're trying to debug the markup or something, you can use
> > >>>> Firefox with the Firebug[1] add-on, which will show you the current
> > >>>> DOM tree rather than the original source.
>
> > >>>> [1]http://getfirebug.com/
>
> > >>>> HTH,
> > >>>> --
> > >>>> T.J. Crowder
> > >>>> tj / crowder software / comwww.crowdersoftware.com
>
> > >>>> On Sep 18, 11:27 pm,Kumar<kumar.k.re...@gmail.com> wrote:
>
> > >>>>> Hi All -
>
> > >>>>> I am using prototype Ajax updater. The main intenntion of using
> > >>>>> updater is to show users a loading icon, but in background we are
> > >>>>> making a series webservice calls to wide variety of systems, then
> > >>>>> collabarate all the data to users at one go.
>
> > >>>>> The page loads and calls ajax updater. Updater inturn updates a div
> > >>>>> tag with a search results. (results are processed in another jsp
> > >>>>> page). Here is the problem. After the entire page gets loaded with
> > >>>>> results, when I see the source I do not see the results grid in the
> > >>>>> source page. I know its just the code that got loaded while making
> > >>>>> ajax calls. How can I induce the code in to the same source file  
> > >>>>> after
> > >>>>> the ajax call.
>
> > >>>>> Did any one face this issue before. if you have any thoughts, please
> > >>>>> share it across. Please shoot me an email, if you are still not  
> > >>>>> clear
> > >>>>> with the issue.
>
> > >>>>> Thanks- Hide quoted text -
>
> > >>>> - Show quoted text -- Hide quoted text -
>
> > >> - Show quoted text -
>
> > --
> > Bill Drescher
> > william {at} TechServSys {dot} com- Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to