Re: speed issues traversing the DOM.
- From: SAM <stephanemoriaux.NoAdmin@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 01 Dec 2008 14:59:51 +0100
Le 12/1/08 12:21 PM, The Natural Philosopher a écrit :
SAM wrote:
Always style in relative (or nothing).
The absolute positioning is only when all other solutions fall down.
Anyway, any tag can be formated as you want.
Absolutely the reverse is true here. *Never* relative. I want pixel accuracy on everything so that the screens look identical no matter what browser or what size the screen is.
Non sens !
That is misunderstanding how works a navigator (and css).
The user can fix his preferences, as such as characters no lower than 14px for instance, while you fixed them to 10px.
I am not trying to be a nice HTML site,
No nice nor pretty or funny matter.
With an html well built (conform) using its hierarchical tags cleverly (or only normally) all is then easier to arrange the display.
You are completely in error about the method to adopt for your project. There has not to browse the DOM to re-hide the details, they are naturally hidden.
Not if hey have just been switched on they aren't.
Perhaps could you have a look on my last exchanges with David and Laurent that run me to a simple (I mean an unique) listener on the entire page that does all the job without having
- to traverse the DOM on load
- to hide all divs they are to
Result :
<http://cjoint.com/data/lEvswiroOX_flyout_noLeak_LV_Listener.htm>
Source-code :
<view-source:http://cjoint.com/data/lEvswiroOX_flyout_noLeak_LV_Listener.htm>
This example is only an example +/- well finished and certainly doesn't display items and their details as you want, so don't take care of that.
This little demo is only an example with some items and their details hard coded (no JS to fill up the page) to show how an alone function can survey all elements of a page (without having to run through the DOM for inspect all items or for hiding their details)
Why won't you use Json ?
Ive tried on occasion a few other peoples libraries and found them extremely fragile.
Json is not a "library" in the sens you ear it : it is a tool.
And a tool very light and very fast and very very very -if not extremely- useful when you have to exploit databases.
I give you back url :
client-side :
<http://www.json.org/js.html>
php server-side :
<http://pecl.php.net/package/json>
Json :
<http://www.json.org/>
In fact this whole *project* goes back about 17 years to when somneone aid 'there must be some stock control manufacturing software out there that does all this'(...)
Well, now I am. :-)
but since 17 years a lot of new features shorter or faster have born.
The server would have do the job : all in a JS array
And JS would have only to use this array (not to build it !)
fly(index);
yeah. I pondered that approach. However in the end I prefer no to use other peoples libraries: I make my own that do what I want exactly, and I can fix them when they end up slow, or whatever.
It is not showing cleverness when you prefer to remake (badly ?) what others made better than you ever think to get.
Plus at the time I started this, I was pretty ignorant about javascript and the DOM, as you can see.
It's the case to say so ;-)
So the less javascript teh better was my initial assumption.
Try to progress as you're wrong in your approach of the problem.
Now I am getting more familiar, it doesn't seem such a bad approach..but I dot want to redo everything iove got so far thanks!
Good, formidable (private)David: means wonderful(/private).
forgive to have the page completely made in htmlYeah. I hear you. But that mens I cant proto styles and layouts easily on a non script environment. Like e.g. using dreamweaver to make appearances.
leave the JS to complete from Json array each flyout on demand
Ho! If you are yet using DW you're not at the end of your pain !
To use DW you have to know, at least well, the HTML and CSS, if not that's the soft which decides for you or run you in errors (as absolute that is the default feature proposed by DW).
I all code manually in a text-editor who knows the html (and has colorized-codes for JS, CSS, HTML (and a lot of programming languages))
and then adding the scripts to fill in values.
You only have to html code one, and only one, item and to arrange it with CSS (hiding/showing details or whatever you need to).
Then the JS with help of Json will create the 999 following items.
Cloning the initial item then changing its contents with what it is in the Json array and finally adding the new one, and that for the 999.
(the filling of details can also be made only on demand, as soon as you mouse over an item, instead of to complete all of them on loading and to spend some milliseconds more at load)
but its easier to debug CSS stuff than javascript.
The main problem is your used of JavaScript, I think.
Seen from my chair, your mis knowing of what JS is able to do doesn't help you in your project.
Going all script makes it more elegant, but would require a months rewrite.
Mais non !
Just to begin back from scratch.
If your database is well organized and filled up, and if you use json approach to extract datas, most of the job is done.
The JS script would have to be finished since we are talking of it here.
The tag 'A' ?
as shown previously here : <http://cjoint.com/?lDsFPCPNv4>
and that doesn't need javascript (click the top link to see the code)
Details are in a hidden <span> revealed on mouse overing its parent.
Can a style="position; absolute;" be applied to a span?
Did you have a look to previous links (view-source) ?
Can you read a stylesheet (and understand it) ?
Once more, you certainly do not need absolute positioning.
span { display: block; position: absolute }
a { display: block; position: absolute }
tt { etc ... }
but with tt it's a syntax error as this tag is to display text in font Courier.
Did you ear speaking of float: left; float: right; ?
(and clear: both; )
To put in a favorite-button of your personal bar :
<http://www.w3.org/TR/CSS21/indexlist.html>
The same code will be used when entering orders as well, so you can pick from (a salable subset of) the inventory.
that's the job of a next file, no ?
Nope. Next div actually.
I wanted to say to command the candies.
Now filling in e.g. sales order could be done by building up a page using script and then doing one update. But only if all the data needed is there.
Did you ear of Ajax ?
Can't you serialize/organize your presentation ?
<div>
<h2>title</h2>
<p>Normal viewed text</p>
<p class="hid">content to reveal on mouse over</p>
</div>
It is done that way. But class is not a unique identifier,,have ti use IDS
I think you need no identifier,
I need it as the TARGET of what to switch on.
No.
See the demo above where no item has an ID.
(it use only an alone target for all the items)
The html ID can help to find an article in the server-side database.
Notice that an html ID cannot begin with a number.
At worst with a Json approach you have the array of items and each sub-array of their contents, the item knows its own index (given on load by php or JS, depends your choice) and it has only do display its own sub-array (at same index).
--
sm
.
- Follow-Ups:
- Re: speed issues traversing the DOM.
- From: David Mark
- Re: speed issues traversing the DOM.
- References:
- Re: speed issues traversing the DOM.
- From: The Natural Philosopher
- Re: speed issues traversing the DOM.
- Prev by Date: Re: In Firefox (2.0.0.18) .readyState hung at 3 while .responseText has the data but .responseXML is nul.
- Next by Date: Re: speed issues traversing the DOM.
- Previous by thread: Re: speed issues traversing the DOM.
- Next by thread: Re: speed issues traversing the DOM.
- Index(es):
Relevant Pages
|