I raised this last week, and found a reasonable hack, but would like to
get a better solution, and hopefully a more elegant solution..that runs
a heck of a lot faster.
basically its a flyout menu system,
of this sort of form
<Div frame>
<div an elemenet onmuosover selcet child frame and cancel others>click
me</div>
.......
...
</div> <!-- end the frame. -->
This lot is php created, so its no big deal to utterly change the 2000
odd elements with mouseovers attached.
Now currently each frame has an ID so I can traverse them all, switching
off the ones no longer wanted, and switching on the one that is.
The trouble is, the HTML and script to tell each JS onmouseover which to
turn on and which to turn off would be massive.
That would kill the page load time.
By traversing all the divs, till the right ones are found, its not too
bad, but when I added a second example of this type to the same page,
there seems to be a 4 times slowdown.
Its got unacceptable. i have around 2000 divs on the page, and scanning
the lot and checking each one seems to take about half a second in
firefox, and nearly two seconds in Ie7.
My previous hack consisted in registering which ones were relevant into
a table. Do if a div had been turned ON, it would be in the table, and
if not well..then you had to find it to turn it on. This worked fairly
well after a few slow scans, as te tale was then mostly complete.
But it would be nice to know a better way of creating a subset of all
the divs in the page that cold be searched faster. Preferable when te
page is assembled, rather than when it is run.
So teh questions are of two basic kinds.
Firstly, how can you at page creation time build a set of references to
DOM objects..?
Sort of <div <script> register(this)</script>> </div> ?
Is anything like that possible?
If thats not possible how is teh DOM structired..fir example if I give
te parent conainers and ID, can I merely search their children, rather
then the whole p[ge?
i.e. if I do a
document.geteElementById('container').getElementsByTagName('div') is
that efficient to isolate only those divs inside that container?
Another useful one would be a docment.getElementsByZIndex('n') :-()
So how to efficiently either register, or find, certain divs is the
problem. Given a bloody lot of them in the first place, most of which
are superfluous to the search.
|
|
0
|
|
|
|
Reply
|
The
|
11/29/2008 11:41:06 AM |
|
The Natural Philosopher wrote:
> I raised this last week, and found a reasonable hack, but would like to
> get a better solution, and hopefully a more elegant solution..that runs
> a heck of a lot faster.
>
> basically its a flyout menu system,
>
> of this sort of form
>
> <Div frame>
> <div an elemenet onmuosover selcet child frame and cancel others>click
> me</div>
> ......
>
> ..
>
> </div> <!-- end the frame. -->
>
>
> This lot is php created, so its no big deal to utterly change the 2000
> odd elements with mouseovers attached.
>
> Now currently each frame has an ID so I can traverse them all, switching
> off the ones no longer wanted, and switching on the one that is.
>
>
> The trouble is, the HTML and script to tell each JS onmouseover which to
> turn on and which to turn off would be massive.
>
> That would kill the page load time.
>
> By traversing all the divs, till the right ones are found, its not too
> bad, but when I added a second example of this type to the same page,
> there seems to be a 4 times slowdown.
>
> Its got unacceptable. i have around 2000 divs on the page, and scanning
> the lot and checking each one seems to take about half a second in
> firefox, and nearly two seconds in Ie7.
>
> My previous hack consisted in registering which ones were relevant into
> a table. Do if a div had been turned ON, it would be in the table, and
> if not well..then you had to find it to turn it on. This worked fairly
> well after a few slow scans, as te tale was then mostly complete.
>
> But it would be nice to know a better way of creating a subset of all
> the divs in the page that cold be searched faster. Preferable when te
> page is assembled, rather than when it is run.
>
> So teh questions are of two basic kinds.
>
> Firstly, how can you at page creation time build a set of references to
> DOM objects..?
>
> Sort of <div <script> register(this)</script>> </div> ?
>
> Is anything like that possible?
>
> If thats not possible how is teh DOM structired..fir example if I give
> te parent conainers and ID, can I merely search their children, rather
> then the whole p[ge?
>
> i.e. if I do a
> document.geteElementById('container').getElementsByTagName('div') is
> that efficient to isolate only those divs inside that container?
>
> Another useful one would be a docment.getElementsByZIndex('n') :-()
>
> So how to efficiently either register, or find, certain divs is the
> problem. Given a bloody lot of them in the first place, most of which
> are superfluous to the search.
Bit of an update: I traced this to several problems, the real crawler
being a redundant mouseover event that was searching every div in the
document.
What it basically boils down to that getElementByDiv() is only about
2500 divs/sec on a rather dull PC on IE7. Its about 2-3 times that on
Firefox.
I've hacked a workaround that gives me the speed I want, by storing each
<div> I turn on in an array, that can be run through to turn them off,
but I'd still like an answer to a better way to do it. To essentially
pre-load the array.
|
|
0
|
|
|
|
Reply
|
The
|
11/29/2008 4:23:57 PM
|
|
Le 11/29/08 12:41 PM, The Natural Philosopher a �crit :
> I raised this last week, and found a reasonable hack, but would like to
> get a better solution, and hopefully a more elegant solution..that runs
> a heck of a lot faster.
>
> basically its a flyout menu system,
>
> of this sort of form
>
> <Div frame>
> <div an elemenet onmuosover selcet child frame and cancel others>click
what does mean 'selcet' ? select ?
what does mean "to select child *frame*" ?
what do you want to do with the children ?
> me</div>
is that an obligation to work only with divs ?
and with "more than 2000" of them ?
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>
Can't you use only CSS ?
demo:
<http://cjoint.com/?lDsFPCPNv4>
If really you prefer to use javascript :
using JS to fix the onmouseOver and onmouseOut on 2400 elements
- my FF.3 needs 0.1 second
- my IE.6 needs 1.1 second
demo:
<http://cjoint.com/?lDsIHv3nDn>
To fix the mouse events you don't need to loop all the 'DIVs'
then, while looping, you don't need to retain the correct ones.
Try to use what HTML gives as special tags and loop only this ones
(in the demo I used the tag 'DL')
Before to show the correct one, the function show/hide has not to
disabled all divs that have this mouse events.
onmouseover="show(this);"
monmouseout="hide(this);"
Or with the bit of code above :
<div
onmouseover="this.className='show';"
onmouseout="this.className=''>
<h2>title</h2>
<p>Normal viewed text</p>
<p class="hid">content to reveal on mouse over</p>
</div>
And the associated css :
div .hid { display: none; }
div.show .hid { display: block; }
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
11/29/2008 5:57:00 PM
|
|
Le 11/29/08 6:57 PM, SAM a �crit :
>
> If really you prefer to use javascript :
> demo:
> <http://cjoint.com/?lDsIHv3nDn>
and using document.all instead of document.getElementById('DL')
it is a few longer
<http://cjoint.com/?lDt5zsSAVm>
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
11/29/2008 7:01:59 PM
|
|
On Nov 29, 2:01=A0pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
> Le 11/29/08 6:57 PM, SAM a =E9crit :
>
>
>
> > If really you prefer to use javascript :
> > demo:
> > <http://cjoint.com/?lDsIHv3nDn>
>
> and using document.all instead of document.getElementById('DL')
> it is a few longer
> <http://cjoint.com/?lDt5zsSAVm>
>
You would have to be mad to use this code.
/* ***** no javascript except to fill up the page with 2000 items and
more ******* */
No, there is some.
function see(what) {
what.className =3D what.className=3D=3D''? 'show' : '';
}
The "what" argument is unnecessary and foreshadows a bigger problem.
window.onload =3D function() {
// is it IE ?
var IE =3D false; /*@cc_on IE =3D true @*/
Needless. Use CC only when necessary (virtually never.)
// installation of 200 divs with each having 12 objects
var m =3D function() { return document.getElementById('menu').cloneNode
(true);};
for(var i=3D0; i<200; i++) {
var m1 =3D m();
m1.id =3D 'm_'+i;
m1.getElementsByTagName('h3')[0].innerHTML =3D 'Menu #'+(+i+2);
document.body.appendChild(m1);
}
It needs gEBTN, appendChild, cloneNode and the non-standard innerHTML
property just to get started, but detects nothing.
// stop before following
alert('all 2400 elements in place\ncreation of the 4800 mouse
events');
Implied global.
var t1 =3D new Date()
// creation of mouse events on the 2400 items
if(IE) {
Use feature detection for this.
var d =3D document.all, n =3D d.length;
for(var i=3D0; i<n; i++) if(d[i].tagName.toLowerCase() =3D=3D 'dl')
{
d[i].onmouseover =3D function() { see(this); };
d[i].onmouseout =3D function() { see(this); };
Needless inner functions, which also create circular references
involving elements.
http://www.jibbering.com/faq/faq_notes/closures.html#clMem
}
}
else {
var d =3D document.getElementsByTagName('DL'), n =3D d.length;
for(var i=3D0; i<n; i++) {
d[i].onmouseover =3D function() { see(this); };
d[i].onmouseout =3D function() { see(this); };
Same.
}
}
var t2 =3D new Date();
alert('Mouse events finished in : '+(+t2-t1)/1000+' seconds');
And lots of memory leaked. Set d to null to break the 2400 x 2
chains.
}
Use one listener for things like this. Delegate based on the event
target. And don't create memory leaks.
|
|
0
|
|
|
|
Reply
|
David
|
11/29/2008 7:30:29 PM
|
|
�a y est c'est mon tour.
Je sens que �a va �tre ma f�te ! !
Le 11/29/08 8:30 PM, David Mark a �crit :
> On Nov 29, 2:01 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
> wrote:
>> Le 11/29/08 6:57 PM, SAM a �crit :
>>
>>> If really you prefer to use javascript :
>>> demo:
>>> <http://cjoint.com/?lDsIHv3nDn>
>> and using document.all instead of document.getElementById('DL')
>> it is a few longer
>> <http://cjoint.com/?lDt5zsSAVm>
>>
>
> You would have to be mad to use this code.
The next line is a mistake
(coming from a previous file that had no JS, see previous link in
previous post)
> /* ***** no javascript except to fill up the page with 2000 items and
> more ******* */
>
> No, there is some.
Yes, a bit.
> function see(what) {
> what.className = what.className==''? 'show' : '';
> }
>
> The "what" argument is unnecessary and foreshadows a bigger problem.
Some light about the bigger problem ?
If no argument, what do you propose ?
> window.onload = function() {
> // is it IE ?
> var IE = false; /*@cc_on IE = true @*/
>
> Needless. Use CC only when necessary (virtually never.)
I use that code when I want ! non mais !
As some browsers accept document.all when in same time they prefer GDBI
I use CC to be sure to speak exclusively to IE (unlovely that catches IE
Mac too).
> // installation of 200 divs with each having 12 objects
Yes, I'll not copy-paste 200 times same lines.
(and come back on them to change the IDs and the texts, 12 times was enough)
> var m = function() { return document.getElementById('menu').cloneNode
> (true);};
> for(var i=0; i<200; i++) {
> var m1 = m();
> m1.id = 'm_'+i;
> m1.getElementsByTagName('h3')[0].innerHTML = 'Menu #'+(+i+2);
> document.body.appendChild(m1);
> }
>
> It needs gEBTN, appendChild, cloneNode and the non-standard innerHTML
> property just to get started, but detects nothing.
The non-standard innerHTML is de facto a standard if used knowing what
it does.
What do you want it detects ? (what is "it" ?)
maybe : getElementsByTagName ?
> // stop before following
> alert('all 2400 elements in place\ncreation of the 4800 mouse
> events');
>
> Implied global.
Not understood.
> var t1 = new Date()
> // creation of mouse events on the 2400 items
> if(IE) {
>
> Use feature detection for this.
Can you give me a detection will ensure that the browser is IE
and *only* IE ?
> var d = document.all, n = d.length;
> for(var i=0; i<n; i++) if(d[i].tagName.toLowerCase() == 'dl')
> {
> d[i].onmouseover = function() { see(this); };
> d[i].onmouseout = function() { see(this); };
>
> Needless inner functions, which also create circular references
> involving elements.
I asked Google to help me understand your sentence in pure pain
(Needless inner functions ?)
> http://www.jibbering.com/faq/faq_notes/closures.html#clMem
Je ne comprends rien aux closures, il n'y a pas de mot francais pour en
traduire le sens.
I definitively understand nothing about closures.
Isn't it enough to close the page to leave the closure ?
I do not see a circular reference in
onmouseover="see(this)"
except on same element (on itself).
And it is well the goal : to do something with itself.
(to do not have an argument wouldn't have to change something about
circular ref)
> }
> }
> else {
> var d = document.getElementsByTagName('DL'), n = d.length;
> for(var i=0; i<n; i++) {
> d[i].onmouseover = function() { see(this); };
> d[i].onmouseout = function() { see(this); };
>
> Same.
>
> }
> }
> var t2 = new Date();
>
> alert('Mouse events finished in : '+(+t2-t1)/1000+' seconds');
>
> And lots of memory leaked.
Pas grave, il doit en rester.
With UC that have in this time 2Go and more memory, what could do a
little leak like that ?
Have I to put in my pages a button to relaunch Windows ?
> Set d to null to break the 2400 x 2
> chains.
>
> }
>
> Use one listener for things like this. Delegate based on the event
> target. And don't create memory leaks.
OK, I will try.
Just I don't remember how to do.
<http://cjoint.com/?lDx3fnF8XZ>
(don't look at the JS copyclone : I have no server access on cjoint)
The listener takes 20% more time in my FF.3 and 10 times more time (tts:
14 to 16 seconds) in my IE.6 than the leaking memory.
Perhaps there is something wrong in my code ?
(I found somewhere the listener function)
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
11/29/2008 11:25:16 PM
|
|
SAM wrote:
> Le 11/29/08 12:41 PM, The Natural Philosopher a �crit :
>> I raised this last week, and found a reasonable hack, but would like
>> to get a better solution, and hopefully a more elegant solution..that
>> runs a heck of a lot faster.
>>
>> basically its a flyout menu system,
>>
>> of this sort of form
>>
>> <Div frame>
>> <div an elemenet onmuosover selcet child frame and cancel others>click
>
> what does mean 'selcet' ? select ?
>
> what does mean "to select child *frame*" ?
> what do you want to do with the children ?
>
Its a hierarchical tree menu. Elements are in pages
I call a flyout page a frame.
There are an indefinite amount of elements within each flyout page. Each
one is either a mouseover event that spawns yet another leaf, or a
clickable entity, so each one is a div. Perhaps it needn't be, but that
makes absolute formatting easier. It is extremely difficult to establish
when one frame flys out, what others should be canceled, so the
algorithnm simply un-dispalys all at the same level or below, except the
direct child of the mouseover one.
That means a reasonable amount of frames have to be canned. Ive limited
it to just the flyout frames now, which has speeded things up a lot.
The problem resolves to the simplest way of creating a substructure to
scan, that has pointers into only the relevant DOM elements that need
scanning.
My hack is to register each frame as it is turned on by adding it to an
array of elements 'that have been turned on' and to turn off the ones in
that array solely.
I was just hoping that there might be a way to have that array loaded at
download time, but I don't see a simple way of passing a pointer to a
dom object before javascript actually runs, or, how to perform the scan
of the relevant elements efficiently at load time.
If you like,. given a random selection of DOM elements that you want to
access and modify via javascript, how can you tag them so that they and
they alone can be the subject of efficient searches?
So far I have only found one way, and that is to have an onmouseover
event tell a registration fubction 'hey I am a mousover elements child,
I'm the one that needs to be in your data structure: then one
getelementById once, identifies the object that will need undisplaying
later.
So, the function that uniquely sets a container of menu elements to
'block' also registers that element on the list of elements to be
undisplayed
Hers is a fragment from a simplert tow level meenu strictire that
illustates this
*************************************
var menus =new Array() // array for our menus.
// switch on div whose id is 'name'+'id' and register it, all others off
function show (id) // expands a menu of this name at this level with
this parent id.
{
var ourdiv;
var ourid= 'menu'+id; // the div id to switch on.
if(!menus[ourid] && (ourdiv=document.getElementById(ourid)))
{
menus[ourid]=ourdiv;
}
var i;
for (i in menus)
{
if(i==ourid) // thats us
{
menus[i].style.display='block';
document.getElementById("transparent").style.display='block';
// this is a catchall 'glass' screen at lower Zindex that traps movement
// outside the menus
}
else menus[i].style.display='none';
// this collpases all other menus that are registered
}
}
>
> is that an obligation to work only with divs ?
Well, I am a goodish coder, but not a great javascripter, and DOMmer and
divs seemed the way to get entities that were absolutely positioned,
could take an ID, and could take mouse events. If you know better, let
me know..
> and with "more than 2000" of them ?
Yup. I am handling a stores with over 1000 items in about 30 categories,
any one of which must be selectable. The code is generic, but the screen
I am working on is multi-level kitting, so I need to both select a part
- say 'box of chocolates' and craate an assembly that says '2 caramel,
three hazelnut, 1 cherry' and 'box' 'insert' 'contents list' and '5 mins
of packing labour' etc etc.
So the need is to rapidly search through a very large number of
categories and actual items, to insert them in a data structure
representing 'the box of chocolates'
The same code will be used when entering orders as well, so you can pick
from (a salable subset of) the inventory.
I tried using straight <SEECT> <OPTION> but that only allowed a one
dimensional search and selecet, and was too clumsy to be functional. The
customer rejected it.
> 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
> Can't you use only CSS ?
> demo:
> <http://cjoint.com/?lDsFPCPNv4>
>
> If really you prefer to use javascript :
> using JS to fix the onmouseOver and onmouseOut on 2400 elements
> - my FF.3 needs 0.1 second
> - my IE.6 needs 1.1 second
Yup. That was consistent with my findings. Customer has IE7, and I have
that on a scrappy oldish PC. Mostly I run a mac for the desk, and the
codes on linux/apache/php/mysql
AsI say, I have a solution, just hoping for a better one.
> demo:
> <http://cjoint.com/?lDsIHv3nDn>
>
> To fix the mouse events you don't need to loop all the 'DIVs'
> then, while looping, you don't need to retain the correct ones.
> Try to use what HTML gives as special tags and loop only this ones
> (in the demo I used the tag 'DL')
>
you can create a special 'tag' in CSS?
I thought it was styles alone..
Can you give me an example?
> Before to show the correct one, the function show/hide has not to
> disabled all divs that have this mouse events.
>
> onmouseover="show(this);"
> monmouseout="hide(this);"
>
Onmouseout proved to be very unreliable with much bubbling.
In fact part of te problem I had was with having a second menu 'screen'
that would also clear a selection of primary menus. So a menu clear was
needlessly clearing three menus, inneficiently, each one of which was
scanning every div in the page. So I was up to around 7500 div searches.
Not good.
I've cleaned that up a lot, by teh registration code above. It works ok,
and seems browaer generic, but it seemed a bit of a hack, thats all.
and I wondered if there was a better way.
> Or with the bit of code above :
>
> <div
> onmouseover="this.className='show';"
> onmouseout="this.className=''>
> <h2>title</h2>
> <p>Normal viewed text</p>
> <p class="hid">content to reveal on mouse over</p>
> </div>
>
> And the associated css :
>
> div .hid { display: none; }
> div.show .hid { display: block; }
>
Well that's not nearly good enough. I dont want to clear parent menus
when I move to a child, not least because that leaves my cursor hanging
over nothing.
I'd post the URL so you can see it working, but sadly that would nee a
name/password and you then get access to real data on my database which
ain't mine to give away, and contains not a little =intellectual
property. It ain't boxes of chocolates.. ;-)
>
|
|
0
|
|
|
|
Reply
|
The
|
11/30/2008 12:05:51 AM
|
|
On Nov 29, 6:25=A0pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
> =C7a y est c'est mon tour.
> Je sens que =E7a va =EAtre ma f=EAte ! !
>
> Le 11/29/08 8:30 PM, David Mark a =E9crit :
>
> > On Nov 29, 2:01 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
> > wrote:
> >> Le 11/29/08 6:57 PM, SAM a =E9crit :
>
> >>> If really you prefer to use javascript :
> >>> demo:
> >>> <http://cjoint.com/?lDsIHv3nDn>
> >> and using document.all instead of document.getElementById('DL')
> >> it is a few longer
> >> <http://cjoint.com/?lDt5zsSAVm>
>
> > You would have to be mad to use this code.
>
> The next line is a mistake
> (coming from a previous file that had no JS, see previous link in
> previous post)
>
> > /* ***** no javascript except to fill up the page with 2000 items and
> > more ******* */
>
> > No, there is some.
>
> Yes, a bit.
>
> > function see(what) {
> > =A0 what.className =3D what.className=3D=3D''? 'show' : '';
> > =A0 }
>
> > The "what" argument is unnecessary and foreshadows a bigger problem.
>
> Some light about the bigger problem ?
As mentioned, memory leaks. See below.
> If no argument, what do you propose ?
Using the "this" identifier in the listener.
>
> > window.onload =3D function() {
> > =A0 // is it IE ?
> > =A0 var IE =3D false; /*@cc_on IE =3D true @*/
>
> > Needless. =A0Use CC only when necessary (virtually never.)
>
> I use that code when I want ! non mais !
>
> As some browsers accept document.all when in same time they prefer GDBI
> I use CC to be sure to speak exclusively to IE (unlovely that catches IE
> Mac too).
Which is silly. Always test the standard (gEBI in this case) first,
then you won't have a problem.
[snip]
>
> > It needs gEBTN, appendChild, cloneNode and the non-standard innerHTML
> > property just to get started, but detects nothing.
>
> The non-standard innerHTML is de facto a standard if used knowing what
> it does.
No matter. Is isn't needed for this and you didn't test it (or
anything else.)
> What do you want it detects ? (what is "it" ?)
> maybe : getElementsByTagName ?
That would be a start.
>
> > =A0 // stop before following
> > =A0 alert('all 2400 elements in place\ncreation of the 4800 mouse
> > events');
>
> > Implied global.
>
> Not understood.
>
> > =A0 var t1 =3D new Date()
> > =A0 // creation of mouse events on the 2400 items
> > =A0 if(IE) {
>
> > Use feature detection for this.
>
> Can you give me a detection will ensure that the browser is IE
> and *only* IE ?
That isn't what you are trying to detect here. You want to know if
you can use document.all without throwing an exception, so you should
detect document.all (only after testing gEBI.)
>
> > =A0 =A0 =A0var d =3D document.all, n =3D d.length;
Right there it will blow up if some new version of IE eliminates
document.all.
> > =A0 =A0 =A0for(var i=3D0; i<n; i++) if(d[i].tagName.toLowerCase() =3D=
=3D 'dl')
> > =A0 =A0 =A0 =A0 {
> > =A0 =A0 =A0 =A0 d[i].onmouseover =3D function() { see(this); };
> > =A0 =A0 =A0 =A0 d[i].onmouseout =3D function() { see(this); };
>
> > Needless inner functions, which also create circular references
> > involving elements.
>
> I asked Google to help me understand your sentence in pure pain
I know the feeling.
> (Needless inner functions ?)
Yes. Hark back to the "what" argument.
>
> >http://www.jibbering.com/faq/faq_notes/closures.html#clMem
>
> Je ne comprends rien aux closures, il n'y a pas de mot francais pour en
> traduire le sens.
> I definitively understand nothing about closures.
> Isn't it enough to close the page to leave the closure ?
What are you doing creating closures if you know nothing about them?
As the cited article indicates, they can be dangerous in IE. Read the
article. If you print it out double-spaced it is maybe three pages.
>
> I do not see a circular reference in
> =A0 =A0onmouseover=3D"see(this)"
I don't know what that is, but your example created such references.
> except on same element (on itself).
> And it is well the goal : to do something with itself.
> (to do not have an argument wouldn't have to change something about
> circular ref)
You are wrong. No argument =3D no inner function =3D no closure =3D no
circular reference =3D no memory leak.
>
>
>
> > =A0 =A0 =A0 =A0 }
> > =A0 =A0 =A0}
> > =A0 else {
> > =A0 =A0var d =3D document.getElementsByTagName('DL'), n =3D d.length;
> > =A0 =A0for(var i=3D0; i<n; i++) {
> > =A0 =A0 d[i].onmouseover =3D function() { see(this); };
> > =A0 =A0 d[i].onmouseout =3D function() { see(this); };
>
> > Same.
>
> > =A0 =A0 }
> > =A0 }
> > =A0 var t2 =3D new Date();
>
> > =A0 alert('Mouse events finished in : '+(+t2-t1)/1000+' seconds');
>
> > And lots of memory leaked.
>
> Pas grave, il doit en rester.
Do you mind? I don't speak French.
> With UC that have in this time 2Go and more memory, what could do a
> little leak like that ?
Open your task manager and find out. Or just set the nodelist
reference to null as mentioned.
> Have I to put in my pages a button to relaunch Windows ?
No, you need to learn to write proper scripts.
>
> > Set d to null to break the 2400 x 2
> > chains.
>
> > =A0}
>
> > Use one listener for things like this. =A0Delegate based on the event
> > target. =A0And don't create memory leaks.
>
> OK, I will try.
> Just I don't remember how to do.
I gave you a link.
> <http://cjoint.com/?lDx3fnF8XZ>
> (don't look at the JS copyclone : I have no server access on cjoint)
I am through looking at it.
>
> The listener takes 20% more time in my FF.3 and 10 times more time (tts:
> 14 to 16 seconds) in my IE.6 than the leaking memory.
> Perhaps there is something wrong in my code ?
Yes. Lots of things.
> (I found somewhere the listener function)
Throw it back.
|
|
0
|
|
|
|
Reply
|
David
|
11/30/2008 1:18:11 AM
|
|
On Nov 29, 12:41=A0pm, The Natural Philosopher <a...@b.c> wrote:
>
> But it would be nice to know a better way of creating a subset of all
> the divs in the page that cold be searched faster. Preferable when te
> page is assembled, rather than when it is run.
>
When the page is assembled: put the <script> tag at the end of the
<body>, right before the </body>, and don't wrap it with
window.onload=3D function () { the script code };. This gives you back
some extra time: the time that the browser kept waiting before
dispatching the "load" event to the "onload" event-handler:
<html>
<head></head>
<body>
<script>
//The dom is ready, all the elements are in-place, but the page
has not been drawn into the screen yet.
</script>
</body>
</html>
Instead, this waits until after everything else has been loaded and
the page has been drawn:
<html>
<head></head>
<body>
<script>
//The dom is ready, all the elements are in-place. Page has not
been drawn yet.
window.onload=3D function () {
//But this won't run until after the page has been drawn and all
its resources have been loaded.
};
</script>
</body>
</html>
AFAIK,
--
Jorge.
|
|
0
|
|
|
|
Reply
|
Jorge
|
11/30/2008 10:20:15 AM
|
|
On Nov 30, 11:20=A0am, Jorge <jo...@jorgechamorro.com> wrote:
> On Nov 29, 12:41=A0pm, The Natural Philosopher <a...@b.c> wrote:
>
>
>
> > But it would be nice to know a better way of creating a subset of all
> > the divs in the page that cold be searched faster. Preferable when te
> > page is assembled, rather than when it is run.
>
> When the page is assembled: put the <script> tag at the end of the
> <body>, right before the </body>, and don't wrap it with
> window.onload=3D function () { the script code };. This gives you back
> some extra time: the time that the browser kept waiting before
> dispatching the "load" event to the "onload" event-handler:
>
> <html>
> <head></head>
> <body>
> =A0 <script>
> =A0 =A0 //The dom is ready, all the elements are in-place, but the page
> has not been drawn into the screen yet.
> =A0 </script>
> </body>
> </html>
>
> Instead, this waits until after everything else has been loaded and
> the page has been drawn:
>
> <html>
> <head></head>
> <body>
> =A0 <script>
> =A0 =A0 //The dom is ready, all the elements are in-place. Page has not
> been drawn yet.
> =A0 =A0 window.onload=3D function () {
> =A0 =A0 =A0 //But this won't run until after the page has been drawn and =
all
> its resources have been loaded.
> =A0 =A0 };
> =A0 </script>
> </body>
> </html>
>
> AFAIK,
> --
> Jorge.
The page's html goes before our <script> tag, obviously:
<body>
<h1>The page</h1>
etc etc.
The last tag ought to be the script:
<script>
--
Jorge.
|
|
0
|
|
|
|
Reply
|
Jorge
|
11/30/2008 10:29:46 AM
|
|
Jorge wrote:
> On Nov 29, 12:41 pm, The Natural Philosopher <a...@b.c> wrote:
>> But it would be nice to know a better way of creating a subset of all
>> the divs in the page that cold be searched faster. Preferable when te
>> page is assembled, rather than when it is run.
>>
>
> When the page is assembled: put the <script> tag at the end of the
> <body>, right before the </body>, and don't wrap it with
> window.onload= function () { the script code };. This gives you back
> some extra time: the time that the browser kept waiting before
> dispatching the "load" event to the "onload" event-handler:
>
> <html>
> <head></head>
> <body>
> <script>
> //The dom is ready, all the elements are in-place, but the page
> has not been drawn into the screen yet.
> </script>
> </body>
> </html>
>
> Instead, this waits until after everything else has been loaded and
> the page has been drawn:
>
> <html>
> <head></head>
> <body>
> <script>
> //The dom is ready, all the elements are in-place. Page has not
> been drawn yet.
> window.onload= function () {
> //But this won't run until after the page has been drawn and all
> its resources have been loaded.
> };
> </script>
> </body>
> </html>
>
> AFAIK,
> --
> Jorge.
Wellthat is handy enough and worth knowing, but only answers half the
question..
I suspect my problem is that I am unused to interpreted languages.
In a compiled language and element like a DIV gets a label, and you can
refer to it anywhere you like as you WRITE the code.
It seems that in the javascript DOM context all you can do is give it an
ID and then have the code LOOK for it at runtime.
Is that essentially the case?
|
|
0
|
|
|
|
Reply
|
The
|
11/30/2008 10:54:30 AM
|
|
Jorge wrote:
> On Nov 30, 11:20 am, Jorge <jo...@jorgechamorro.com> wrote:
>> On Nov 29, 12:41 pm, The Natural Philosopher <a...@b.c> wrote:
>>
>>
>>
>>> But it would be nice to know a better way of creating a subset of all
>>> the divs in the page that cold be searched faster. Preferable when te
>>> page is assembled, rather than when it is run.
>> When the page is assembled: put the <script> tag at the end of the
>> <body>, right before the </body>, and don't wrap it with
>> window.onload= function () { the script code };. This gives you back
>> some extra time: the time that the browser kept waiting before
>> dispatching the "load" event to the "onload" event-handler:
>>
>> <html>
>> <head></head>
>> <body>
>> <script>
>> //The dom is ready, all the elements are in-place, but the page
>> has not been drawn into the screen yet.
>> </script>
>> </body>
>> </html>
>>
>> Instead, this waits until after everything else has been loaded and
>> the page has been drawn:
>>
>> <html>
>> <head></head>
>> <body>
>> <script>
>> //The dom is ready, all the elements are in-place. Page has not
>> been drawn yet.
>> window.onload= function () {
>> //But this won't run until after the page has been drawn and all
>> its resources have been loaded.
>> };
>> </script>
>> </body>
>> </html>
>>
>> AFAIK,
>> --
>> Jorge.
>
> The page's html goes before our <script> tag, obviously:
>
> <body>
>
> <h1>The page</h1>
>
> etc etc.
>
> The last tag ought to be the script:
> <script>
Sorry, you have confused me - script inside the body, or outside.
<html>
<head>
</head>
<body>
a lot of body
<script>
startup stuff
</script>
</body>
</html>
Or
<html>
<head>
</head>
<body>
a lot of body
</body>
<script>
startup stuff
</script>
</html>
???
<
>
> --
> Jorge.
|
|
0
|
|
|
|
Reply
|
The
|
11/30/2008 10:58:27 AM
|
|
On Nov 30, 5:20=A0am, Jorge <jo...@jorgechamorro.com> wrote:
> On Nov 29, 12:41=A0pm, The Natural Philosopher <a...@b.c> wrote:
>
>
>
> > But it would be nice to know a better way of creating a subset of all
> > the divs in the page that cold be searched faster. Preferable when te
> > page is assembled, rather than when it is run.
>
> When the page is assembled: put the <script> tag at the end of the
> <body>, right before the </body>, and don't wrap it with
> window.onload=3D function () { the script code };. This gives you back
> some extra time: the time that the browser kept waiting before
> dispatching the "load" event to the "onload" event-handler:
It doesn't give you extra time, it causes the script to run before the
body has finished loading.
>
> <html>
> <head></head>
> <body>
> =A0 <script>
> =A0 =A0 //The dom is ready, all the elements are in-place, but the page
The DOM cannot be considered "ready" at this point. And all of the
elements are not in place. The body hasn't even closed. Google
"Operation Aborted" and IE.
[snip]
|
|
0
|
|
|
|
Reply
|
David
|
11/30/2008 11:04:32 AM
|
|
On Nov 30, 5:54=A0am, The Natural Philosopher <a...@b.c> wrote:
> Jorge wrote:
> > On Nov 29, 12:41 pm, The Natural Philosopher <a...@b.c> wrote:
> >> But it would be nice to know a better way of creating a subset of all
> >> the divs in the page that cold be searched faster. Preferable when te
> >> page is assembled, rather than when it is run.
>
> > When the page is assembled: put the <script> tag at the end of the
> > <body>, right before the </body>, and don't wrap it with
> > window.onload=3D function () { the script code };. This gives you back
> > some extra time: the time that the browser kept waiting before
> > dispatching the "load" event to the "onload" event-handler:
>
> > <html>
> > <head></head>
> > <body>
> > =A0 <script>
> > =A0 =A0 //The dom is ready, all the elements are in-place, but the page
> > has not been drawn into the screen yet.
> > =A0 </script>
> > </body>
> > </html>
>
> > Instead, this waits until after everything else has been loaded and
> > the page has been drawn:
>
> > <html>
> > <head></head>
> > <body>
> > =A0 <script>
> > =A0 =A0 //The dom is ready, all the elements are in-place. Page has not
> > been drawn yet.
> > =A0 =A0 window.onload=3D function () {
> > =A0 =A0 =A0 //But this won't run until after the page has been drawn an=
d all
> > its resources have been loaded.
> > =A0 =A0 };
> > =A0 </script>
> > </body>
> > </html>
>
> > AFAIK,
> > --
> > Jorge.
>
> Wellthat is handy enough and worth knowing, =A0but only answers half the
> question..
>
> I suspect my problem is that I am unused to interpreted languages.
I wouldn't close the investigation just yet.
>
> In a compiled language and element like a DIV gets a label, and you can
> refer to it anywhere you like as you WRITE the code.
Well, I am glad we got that sorted out.
>
> It seems that in the javascript DOM context all you can do is give it an
> =A0 ID and then have the code LOOK for it at runtime.
You've been told repeatedly that the DOM is not part of the language.
This looks like VK syndrome.
>
> Is that essentially the case?
Your case worker will be with you shortly.
|
|
0
|
|
|
|
Reply
|
David
|
11/30/2008 11:16:14 AM
|
|
On Nov 30, 5:58=A0am, The Natural Philosopher <a...@b.c> wrote:
[snip]
>
> Sorry, you have confused me - script inside the body, or outside.
>
Well, it could hardly be after the body could it?
[snip]
|
|
0
|
|
|
|
Reply
|
David
|
11/30/2008 11:19:03 AM
|
|
Le 11/30/08 11:58 AM, The Natural Philosopher a �crit :
> Sorry, you have confused me - script inside the body, or outside.
both please.
<head>
<script ..>
all the necessary functions
- array creation
- events
- and so on
</script>
</head>
<body>
.... blah
.... blah
<script ...>
init(); // start the JS job in the head
</script>
</body>
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
11/30/2008 11:27:40 AM
|
|
Le 11/30/08 12:19 PM, David Mark a �crit :
> On Nov 30, 5:58 am, The Natural Philosopher <a...@b.c> wrote:
>
> [snip]
>
>> Sorry, you have confused me - script inside the body, or outside.
>>
>
> Well, it could hardly be after the body could it?
I saw JS after the html tag closing.
</html>
<script ...>
(and it seemed to work !)
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
11/30/2008 11:33:20 AM
|
|
On Nov 30, 6:33=A0am, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
> Le 11/30/08 12:19 PM, David Mark a =E9crit :
>
> > On Nov 30, 5:58 am, The Natural Philosopher <a...@b.c> wrote:
>
> > [snip]
>
> >> Sorry, you have confused me - script inside the body, or outside.
>
> > Well, it could hardly be after the body could it?
>
> I saw JS after the html tag closing.
You saw a malformed document.
>
> </html>
> <script ...>
>
> (and it seemed to work !)
That is called error correction and it is best not to bank on it.
|
|
0
|
|
|
|
Reply
|
David
|
11/30/2008 11:48:53 AM
|
|
>
> In a compiled language and element like a DIV gets a label, and you can
> refer to it anywhere you like as you WRITE the code.
>
> It seems that in the javascript DOM context all you can do is give it an
> ID and then have the code LOOK for it at runtime.
>
> Is that essentially the case?
If the element has been inserted into the DOM by the html parser, then
yes, you need to find it first somehow, at least once, (walkTheDOM,
use a DOM search method (.getElementXXX) or lookup into an
htmlCollection) in order to get (and save) a reference to it.
If it was inserted into the DOM by your (JS) code, you already have a
reference to it (that you can save) so there's never the need to
search for it.
You can build the contents of that shop's catalog at the server and
send it prebuilt tagged as html, or
You can build it dynamically, client-side, by sending the *data* from
the server, not markup no html (usually JSON).
For example: the server's PHP can send it either:
prebuilt as html:
<div id="reference456">Chocolat Cookies</div>
<div id="reference457">Plum Cake</div>
Or as data:
<script>
var catalog= {
'reference456': 'Chocolat Cookies',
'reference457': 'Plum Cake'
};
</script>
In the second case, the browser has the catalog as data, and the JS
code (client-side) has to build the presentation of that data:
<script>
(function () {
if (catalog && (typeof catalog === "object")) {
var itemRef, itemName, itemDOMElement;
for ( itemRef in catalog ) {
if (catalog.hasOwnProperty(itemRef)) {
//create the DOM element
itemDOMElement= document.createElement('div');
//Fill the div's content
itemDOMElement.innerHTML= itemName= catalog[itemRef];
//Pack it all into an object
catalog[itemRef]= {
'itemName': itemName,
'itemDOMElement': itemDOMElement,
'anotherUsefulProperty': Math.random()
};
//And insert the element into the page.
document.body.appendChild(itemDOMElement);
/* or:
document.body.appendChild(catalog[itemRef].itemDOMElement);
/*
}
}
}
})();
</script>
You'd end up with a nice JS data structure (object) : catalog= {
'reference456': {
'itemName': "Chocolat Cookies",
'itemDOMElement': (referenceToTheDivDOMElement),
'anotherUsefulProperty': (a random number)
},
'reference457': {
'itemName': "Plum Cake",
'itemDOMElement': (referenceToTheDivDOMElement),
'anotherUsefulProperty': (a random number)
}
}
....and no need to ever search the DOM. But, then, your page is turning
more and more into a webApp.
--
Jorge.
|
|
0
|
|
|
|
Reply
|
Jorge
|
11/30/2008 12:03:01 PM
|
|
On Nov 30, 12:04=A0pm, David Mark <dmark.cins...@gmail.com> wrote:
>
> The DOM cannot be considered "ready" at this point. =A0And all of the
> elements are not in place. =A0The body hasn't even closed. =A0Google
> "Operation Aborted" and IE.
>
Well, that you can't append to the body does not mean that the
(already, previously) parsed html elements aren't in-place. They are.
In any case, if you want to be able to append to the (not yet closed)
body tag just wrap the script into a setTimeout( ,0). That's all:
<script>
window.window.window.setTimeout(function () {
// put the code here in order to cure another of
// (the seemingly interminable list of)
// IE's inconvenient "oddities"
},0);
</script>
--
Jorge.
|
|
0
|
|
|
|
Reply
|
Jorge
|
11/30/2008 12:21:25 PM
|
|
Jorge wrote:
>> In a compiled language and element like a DIV gets a label, and you can
>> refer to it anywhere you like as you WRITE the code.
>>
>> It seems that in the javascript DOM context all you can do is give it an
>> ID and then have the code LOOK for it at runtime.
>>
>> Is that essentially the case?
>
> If the element has been inserted into the DOM by the html parser, then
> yes, you need to find it first somehow, at least once, (walkTheDOM,
> use a DOM search method (.getElementXXX) or lookup into an
> htmlCollection) in order to get (and save) a reference to it.
> If it was inserted into the DOM by your (JS) code, you already have a
> reference to it (that you can save) so there's never the need to
> search for it.
Ok. That is one pint finally resolved then.
>
> You can build the contents of that shop's catalog at the server and
> send it prebuilt tagged as html, or
> You can build it dynamically, client-side, by sending the *data* from
> the server, not markup no html (usually JSON).
>
Mmm. I think my ability to do that is constrained by my lack of
familiarity with javascript and the DOM so I'll fie hat for future
reference.
> For example: the server's PHP can send it either:
>
> prebuilt as html:
>
> <div id="reference456">Chocolat Cookies</div>
> <div id="reference457">Plum Cake</div>
>
> Or as data:
>
> <script>
> var catalog= {
> 'reference456': 'Chocolat Cookies',
> 'reference457': 'Plum Cake'
> };
> </script>
>
Yup.
> In the second case, the browser has the catalog as data, and the JS
> code (client-side) has to build the presentation of that data:
>
> <script>
> (function () {
> if (catalog && (typeof catalog === "object")) {
>
> var itemRef, itemName, itemDOMElement;
>
> for ( itemRef in catalog ) {
> if (catalog.hasOwnProperty(itemRef)) {
>
> //create the DOM element
> itemDOMElement= document.createElement('div');
> //Fill the div's content
> itemDOMElement.innerHTML= itemName= catalog[itemRef];
>
> //Pack it all into an object
> catalog[itemRef]= {
> 'itemName': itemName,
> 'itemDOMElement': itemDOMElement,
> 'anotherUsefulProperty': Math.random()
> };
>
> //And insert the element into the page.
> document.body.appendChild(itemDOMElement);
> /* or:
> document.body.appendChild(catalog[itemRef].itemDOMElement);
> /*
> }
> }
> }
> })();
> </script>
>
> You'd end up with a nice JS data structure (object) : catalog= {
> 'reference456': {
> 'itemName': "Chocolat Cookies",
> 'itemDOMElement': (referenceToTheDivDOMElement),
> 'anotherUsefulProperty': (a random number)
> },
>
> 'reference457': {
> 'itemName': "Plum Cake",
> 'itemDOMElement': (referenceToTheDivDOMElement),
> 'anotherUsefulProperty': (a random number)
> }
> }
>
> ...and no need to ever search the DOM. But, then, your page is turning
> more and more into a webApp.
>
I don't really care about what its called, just that it actually works.
At the moment, the faster development route is to use html with some script.
Mostly because I am marginally more familiar with HTML than javascript.
I started out using form inputs and select boxes, but it was too
ugly..so the need to add more script has arrived.
I am not quite ready to go 'all script' as it were, but I take your
points to heart and to memory.
You have been *extremely* helpful, and I thank you for that.
I think what I have now works well enough across the browsers it will be
used with, and the cost benefit of going all script simply for
elegance's sake is not there.
It is in fact a webapp in the sense that its a series of forms into a
database, that simply happen to use a web browser as a means of access.
That turns out to be the simplest way to access the database over local
and remote links, on multiple platforms.
Its a million miles away from a public web site with 'scripted
decoration' , that's for sure.
Its been and continues to be an interesting exercise in code
optimisation: On the one hand it may well be used on relatively low
bandwidth connections, and there compressing the HTML has reduced page
load times impressively (well, if the machine that decompresses has the
horsepower anyway) and reducing visual lag by downloading a lot of the
data so that as much as possible apart from strict database updates, is
done in script in the browser.
I am not sure how the ZIP algorithm works, but it seems to be able to
turn 2000 lines of essentially almost identical information into not
very much at all.
Its now at the stage where flyouts follow the mouse with no perceptible
delays, which is all it needs to be. As opposed to the worst case last
week, where 1.5 seconds was the time.
My biggests lag locally is now decompressing the page..about half a second.
A also managed to turn about 100 nested SQL enquiries into a single
incredibly ugly, but a single, one. That , mysql informs me, takes a
mere 40ms to execute, and less if its cached..;-)
So all intersting stuff, and again, many many thanks for the help.
> --
> Jorge.
|
|
0
|
|
|
|
Reply
|
The
|
11/30/2008 3:29:04 PM
|
|
Le 11/30/08 2:18 AM, David Mark a �crit :
> On Nov 29, 6:25 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
> wrote:
>>
>>>> function see(what) {
>>> what.className = what.className==''? 'show' : '';
>>> }
>>> The "what" argument is unnecessary and foreshadows a bigger problem.
>> Some light about the bigger problem ?
>
> As mentioned, memory leaks. See below.
>
>> If no argument, what do you propose ?
>
> Using the "this" identifier in the listener.
with a bit of code I would better understand.
>>> // is it IE ?
>>> var IE = false; /*@cc_on IE = true @*/
>>> Needless. Use CC only when necessary (virtually never.)
>>
>> As some browsers accept document.all when in same time they prefer gEBI
>> I use CC to be sure to speak exclusively to IE (unlovely that catches IE
>> Mac too).
>
> Which is silly. Always test the standard (gEBI in this case) first,
> then you won't have a problem.
No that's wrong : gEBI is understood by IE and
in my test I want to use exclusively document.all
(and only if the browser is really IE)
see what M$ says :
<http://msdn.microsoft.com/en-us/library/ms537630(VS.85).aspx>
.... the less worst being conditional comments :-(
>>> It needs gEBTN, appendChild, cloneNode and the non-standard innerHTML
>>> property just to get started, but detects nothing.
>> The non-standard innerHTML is de facto a standard if used knowing what
>> it does.
>
> No matter. Is isn't needed for this and you didn't test it (or
> anything else.)
what for ?
its just a demo to see time spending to run through DOM
The JS copy-clone was only to do not copy-paste manually 200 divs
(ang going back on each of them to correct IDs ans texts).
>> What do you want it detects ? (what is "it" ?)
>> maybe : getElementsByTagName ?
>
> That would be a start.
As I'am targeting at worst IE6 ... doest it really matter ?
>> Can you give me a detection will ensure that the browser is IE
>> and *only* IE ?
>
> That isn't what you are trying to detect here. You want to know if
> you can use document.all without throwing an exception, so you should
> detect document.all (only after testing gEBI.)
Once more : no, you're wrong.
I want to detect "IE" and not if the browser is able to do this or that.
>>> var d = document.all, n = d.length;
>
> Right there it will blow up if some new version of IE eliminates
> document.all.
Once more it's to try "document.all" (with actual IEs of course).
Why to pass time to test other obscure and not yet born features ?
Anyway in 30 days the demo-test will be deleted (does M$ expects to
offer a new IE in this delay ?)
>>> Needless inner functions, which also create circular references
>>> involving elements.
>> I asked Google to help me understand your sentence in pure pain
>
> I know the feeling.
Google translates 'needless' by 'it' ... :-(
>> (Needless inner functions ?)
>
> Yes. Hark back to the "what" argument.
Could you code something as example ?
(so I can understand where could be or not the circular ref)
(perhaps ?)
>>> http://www.jibbering.com/faq/faq_notes/closures.html#clMem
>> Je ne comprends rien aux closures, il n'y a pas de mot francais pour en
>> traduire le sens.
>> I definitively understand nothing about closures.
>> Isn't it enough to close the page to leave the closure ?
>
> What are you doing creating closures if you know nothing about them?
Why do you laugh at me like that ?
You know how it's easy to do that by miss knowing.
> As the cited article indicates, they can be dangerous in IE. Read the
> article. If you print it out double-spaced it is maybe three pages.
I've somewhere french tuto about closures on my DD.
(what a brainstorming !)
> You are wrong. No argument = no inner function = no closure = no
> circular reference = no memory leak.
I begin vaguely to understand (outer function getting inner functions's
variable I think I rode)
Can 'this' be seen as an inner-outer-variable ?
in :
foo.onmouseover = function() {see(this);};
which is a so often used way by programmers.
Would it be better (and is it possible ?) to do :
foo.omouseover = 'see(this)';
foo.omouseover = 'see(e)';
foo.omouseover = see;
>>> And lots of memory leaked.
>> Pas grave, il doit en rester.
>
> Do you mind? I don't speak French.
Didn't I see you spoke Spanish ?
>> With UC that have in this time 2Go and more memory, what could do a
>> little leak like that ?
>
> Open your task manager and find out.
??? on My Mac ?
sure I'll find a task manager for IE.linux runing under X11 ;-)
>> Have I to put in my pages a button to relaunch Windows ?
>
> No, you need to learn to write proper scripts.
I wait you for the corrections and not only : "do not do that"
>>> Use one listener for things like this. Delegate based on the event
>>> target. And don't create memory leaks.
>> OK, I will try.
>> Just I don't remember how to do.
>
> I gave you a link.
About listener and events ?
>> <http://cjoint.com/?lDx3fnF8XZ>
>
>> The listener takes 20% more time in my FF.3 and 10 times more time (tts:
>> 14 to 16 seconds) in my IE.6 than the leaking memory.
>> Perhaps there is something wrong in my code ?
>
> Yes. Lots of things.
about the listener I mean.
(the rest except the light about leak memory doesn't really matter here)
>> (I found somewhere the listener function)
>
> Throw it back.
And then ?
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
11/30/2008 3:50:54 PM
|
|
Le 11/30/08 1:05 AM, The Natural Philosopher a �crit :
> SAM wrote:
>> Le 11/29/08 12:41 PM, The Natural Philosopher a �crit :
>>> I raised this last week, and found a reasonable hack, but would like
>>> to get a better solution, and hopefully a more elegant solution..that
>>> runs a heck of a lot faster.
>>>
>>> basically its a flyout menu system,
with 2000 items ... it's not more a menu !
That's a dictionary !
>>> of this sort of form
>>>
>>> <Div frame>
>>> <div an elemenet onmuosover selcet child frame and cancel others>click
>>
>> what ?
>>
> Its a hierarchical tree menu. Elements are in pages
> I call a flyout page a frame.
Bon! me voil� bien avanc� !
(flyout page ?)
For me a "page" is an html file or at least a fragment of.
You can't download and display a such piece of code on a simple mouse
over (overall, if I well understood, you have images to download)
mouseover has to fire immediately.
So, all is in the displayed main file (how much that could do 2000
images and associated texts ?).
Now if you call a frame an <iframe>, probably all is loaded (but the
final weight will be the same : enormous!)
> There are an indefinite amount of elements within each flyout page.
???? you'll have to limit this amount !
> Each one is either a mouseover event that spawns yet another leaf,
No, that's not possible.
(except if by 'spawn' you mean 'show' something already existing, displayed)
> or a clickable entity, so each one is a div.
No, why "so each one is a *DIV*" ?
that could be an <ul> or a <dl>
or do you mean a 'block' (a box, a container, also called layer) ?
> Perhaps it needn't be, but that makes absolute formatting easier.
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.
> It is extremely difficult to establish
> when one frame flys out, what others should be canceled, so the
The flyed frame gives a value to a global variable.
Ne next flyer will close the opened one known by this variable then set
it with itself one.
> algorithnm simply un-dispalys all at the same level or below, except the
> direct child of the mouseover one.
You can have :
- each article downloaded with
- a Hn for it's title and getting the onMouseOver
- a layer (DL ?) for it's illustration, comment, price and so
- the product details (DL) is styled in display:none;
- on mouse overing a title (menu's item) that copy-clone corresponding
hidden details in a viewer positioned where you want
Example not finished, to see what I mean, is here :
<http://cjoint.com/?lEnCvKmZ0s>
and :
<http://cjoint.com/?lEnDaLoOYp>
In both you'll realize the inconvenient to work with onMouseOver ...
> The problem resolves to the simplest way of creating a substructure to
> scan, that has pointers into only the relevant DOM elements that need
> scanning.
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.
It may be enough to drag the sub div details of the article in another
unique div specialized to serve only viewing the wanted details as
showed in my bad made previous examples.
Why won't you use Json ?
It was made exactly for your project.
All informations extracted from the database are in an array made on
server side, so you no longer need to run through the DOM as it is not
yet complete (at least for parties which must show details that will not
be html coded, keeping them in the Json array)
Don't forgive to download all the necessary pictures before to display
the page.
The mouseover function will just to have to use this Json's array to
display the "flyout" where you want.
(each "flyout" is in a sub-array of the main array declared by the PHP
or ASP in the JS of the head.)
In final the body looks like :
<h3 onmouseover="fly(0)">Sweet candy</h3>
<h3 onmouseover="fly(1)">Chocolate 1</h3>
<h3 onmouseover="fly(2)">Candy 1</h3>
....
<h3 onmouseover="fly(2000)">Candy 2000</h3>
<div id="viewer" onmouseout="this.style.display='';">
Here the details
</div>
</body>
> My hack is to register each frame as it is turned on by adding it to an
> array of elements 'that have been turned on' and to turn off the ones in
> that array solely.
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);
> I was just hoping that there might be a way to have that array loaded at
> download time, but I don't see a simple way of passing a pointer to a
> dom object before javascript actually runs, or, how to perform the scan
> of the relevant elements efficiently at load time.
forgive to have the page completely made in html
leave the JS to complete from Json array each flyout on demand
> If you like,. given a random selection of DOM elements that you want to
> access and modify via javascript, how can you tag them so that they and
> they alone can be the subject of efficient searches?
not necessary ---> fly(number)
where number is the index of the item and was written by server (PHP,
ASP ...)
> Hers is a fragment from a simplert tow level meenu strictire that
> illustates this
> *************************************
> var menus =new Array() // array for our menus.
>
> // switch on div whose id is 'name'+'id' and register it, all others off
>
>
> function show (id) // expands a menu of this name at this level with
> this parent id.
OK or some
>> is that an obligation to work only with divs ?
>
> Well, I am a goodish coder, but not a great javascripter, and DOMmer and
> divs seemed the way to get entities that were absolutely positioned,
> could take an ID, and could take mouse events. If you know better, let
> me know..
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.
>> and with "more than 2000" of them ?
>
> Yup. I am handling a stores with over 1000 items in about 30 categories,
> any one of which must be selectable. The code is generic, but the screen
> I am working on is multi-level kitting, so I need to both select a part
> - say 'box of chocolates' and craate an assembly that says '2 caramel,
> three hazelnut, 1 cherry' and 'box' 'insert' 'contents list' and '5 mins
> of packing labour' etc etc.
with a small example it could be easiest to see the purpose.
> So the need is to rapidly search through a very large number of
> categories and actual items, to insert them in a data structure
> representing 'the box of chocolates'
I begin to see.
> 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 ?
>
> I tried using straight <SEECT> <OPTION> but that only allowed a one
> dimensional search and selecet, and was too clumsy to be functional. The
> customer rejected it.
>
>> 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,
on mouseovering one div the event identifies itself what element we'll
have to treate (using only css or helping by JS).
Doesn't it work on the little demo (without IDs) ?
To catch the hidden layer using JS :
var f = this.getElementsByTagName('P'), n = f.length;
for(var i=0; i<n; i++) if(f[i].className=='hid')
{
f = f[i];
break; // or return;
}
f.style.display = 'block';
>> using JS to fix the onmouseOver and onmouseOut on 2400 elements
That David Mark judges very bad.
>> - my FF.3 needs 0.1 second
>> - my IE.6 needs 1.1 second
>
> Yup. That was consistent with my findings. Customer has IE7, and I have
> that on a scrappy oldish PC. Mostly I run a mac for the desk, and the
> codes on linux/apache/php/mysql
I use too a Mac for all.
I have a standalone IE6 via X11 to see what this BS does (or try to).
<http://www.tatanka.com.br/ies4linux/news/49>
<http://www.tatanka.com.br/ies4linux/page/Main_Page>
but the version for Mac dates of 2007
> AsI say, I have a solution, just hoping for a better one.
Json ! Json ! Json !
<http://www.json.org/js.html>
>> Try to use what HTML gives as special tags and loop only this ones
>> (in the demo I used the tag 'DL')
>>
>
> you can create a special 'tag' in CSS?
> I thought it was styles alone.
No you can use any html tag (made to inhering content, as DIV, H1..H5,
P, SPAN, etc...) and transform it in what you want (except TABLE that
causes a lot of problems with IE) as such as a 'block'.
> Can you give me an example?
I did give them !
Did you have a look to their code ? (CSS, HTML, and sometimes JS)
>> Before to show the correct one, the function show/hide has not to
>> disabled all divs that have this mouse events.
Because we act here only on a css class (present or not)
>> onmouseover="show(this);"
>> monmouseout="hide(this);"
>
> Onmouseout proved to be very unreliable with much bubbling.
Not if you leave some space between items (margin).
Not if you have correctly started the IE behavior
Anyway, a click would be a better solution.
M$ mouse capture :
<http://msdn.microsoft.com/en-us/library/ms537630(VS.85).aspx>
> In fact part of te problem I had was with having a second menu 'screen'
> that would also clear a selection of primary menus. So a menu clear was
> needlessly clearing three menus,
But how much all that can weigh ?
Is it really to send on Internet ?
Which connexion and UC will be necessary to have to be able to open and
scroll this page ?
> inneficiently, each one of which was scanning every div in the page.
No. Non sens. Out of work. Bad idea. And so on...
>> Or with the bit of code above :
>>
>> <div
>> onmouseover="this.className='show';"
>> onmouseout="this.className=''>
>> <h2>title</h2>
>> <p>Normal viewed text</p>
>> <p class="hid">content to reveal on mouse over</p>
>> </div>
>>
>> And the associated css :
>>
>> div .hid { display: none; }
>> div.show .hid { display: block; }
>>
>
> Well that's not nearly good enough. I dont want to clear parent menus
> when I move to a child, not least because that leaves my cursor hanging
> over nothing.
It's just a question of CSS to arrange the display as you want.
> I'd post the URL so you can see it working, but sadly that would nee a
> name/password and you then get access to real data on my database which
> ain't mine to give away, and contains not a little =intellectual
> property. It ain't boxes of chocolates.. ;-)
Not seen that URL.
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
11/30/2008 4:01:17 PM
|
|
On 2008-11-30 16:29, The Natural Philosopher wrote:
> Its been and continues to be an interesting exercise in code
> optimisation: On the one hand it may well be used on relatively low
> bandwidth connections, and there compressing the HTML has reduced page
> load times impressively (well, if the machine that decompresses has the
> horsepower anyway) [...]
>
> I am not sure how the ZIP algorithm works, but it seems to be able to
> turn 2000 lines of essentially almost identical information into not
> very much at all.
[...]
> My biggests lag locally is now decompressing the page..about half a
> second.
If you're talking about HTTP compression, I highly doubt that. A
document with ~2000 (normal sized) lines will be decompressed in memory
in a matter of microseconds or less. Better look for the source of your
lag elsewhere.
If you're curious about how ZIP works, the algorithm is described here:
http://en.wikipedia.org/wiki/DEFLATE
- Conrad
|
|
0
|
|
|
|
Reply
|
Conrad
|
11/30/2008 4:28:06 PM
|
|
SAM :
> David Mark :
>> SAM :
>>>
>>>>> function see(what) {
>>>> what.className = what.className==''? 'show' : '';
>>>> }
>>>> The "what" argument is unnecessary and foreshadows a bigger problem.
>>> Some light about the bigger problem ?
>>
>> As mentioned, memory leaks.
>>
>>> If no argument, what do you propose ?
>>
>> Using the "this" identifier in the listener.
>
> with a bit of code I would better understand.
Instead of :
Au lieu de :
function see(what) {
what.className = what.className==''? 'show' : '';
}
[...]
for(var i=0; i<n; i++) {
d[i].onmouseover = function() { see(this); };
d[i].onmouseout = function() { see(this); };
}
You should do something like (probably not exactly what David meant, but
hey, I do what I can with provided rants :) :
Tu devrais faire quelque chose comme ceci (probablement pas exactement
ce que David voulais dire, mais hey, je fais ce que je peux avec les
coups de gueules fournis :) :
function see(e/*the event useless here*/)
{
this.className = this.className == '' ? 'show' : '';
}
[...]
for ( var i = 0; i < n; i++ )
{
d[i].onmouseover = see;
d[i].onmouseout = see;
}
--
laurent
|
|
0
|
|
|
|
Reply
|
Laurent
|
11/30/2008 4:46:04 PM
|
|
Le 11/30/08 4:29 PM, The Natural Philosopher a �crit :
>
> Its been and continues to be an interesting exercise in code
> optimisation: On the one hand it may well be used on relatively low
> bandwidth connections, and there compressing the HTML has reduced page
> load times impressively (well, if the machine that decompresses has the
> horsepower anyway) and reducing visual lag by downloading a lot of the
> data so that as much as possible apart from strict database updates, is
> done in script in the browser.
The most economic in weight is Json :
- Only an array of (real) contents
(the contents comes in pure text without tags, ids, and so on)
- Only a little JS routine to "write" the html code
(or create the document via the DOM)
You'll find nothing shorter in number of lines
(in final file's weight sent to the browser).
Advantage, if you persevere in your idea to hide all non used divs via
JS, the array is already there, no loop in DOM to build it.
> I am not sure how the ZIP algorithm works, but it seems to be able to
gzip worked with Netscape 3 (or 4) no reason that doesn't more work with
new browsers.
Gzipping on server is immediate.
Ungzipping in a browser spend last 1 second.
It was much used when there was not DSL and for numerous tabled datas to
xfer.
> turn 2000 lines of essentially almost identical information into not
> very much at all.
>
> Its now at the stage where flyouts follow the mouse with no perceptible
> delays, which is all it needs to be. As opposed to the worst case last
> week, where 1.5 seconds was the time.
>
> My biggests lag locally is now decompressing the page..about half a second.
Anyway you'll have to wait IE decides to display the final html :-(
You're not at 1/2 second for waiting ;-)
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
11/30/2008 5:10:09 PM
|
|
SAM :
> David Mark :
>> SAM :
>>>> Use one listener for things like this. Delegate based on the event
>>>> target. And don't create memory leaks.
>>> OK, I will try.
>>> Just I don't remember how to do.
>>
>> I gave you a link.
>
> About listener and events ?
St�phane, arr�tes de me faire rire STP, je sais que tu sais :)
Google : event delegation
Simple example, with one single thing very important in mind :
I just don't care about feature detection and other error-prone stuff,
this is just an example to let readers understand the concept of event
delegation, this exact code is not tested and is *not* meant to be used
at all. Let's hope this will prevent another strict flames war.
<ul id="myUL">
<li id="one">1</li>
<li id="two">2</li>
<li id="three">3</li>
</ul>
Let's add a listener to all the <li>, it will alert their id when clicked.
1) "Usual" way to add listeners (kinda bad)
-------------------------------------
function listener(e) { alert(this.id); }
// error-prone, use <body onload="">, blah blah, yeah I know
window.onload = function()
{
// feature detection not here, blah blah, yeah I know
var
li_1 = document.getElementById('one'),
li_2 = document.getElementById('two'),
li_3 = document.getElementById('three');
li_1.onclick = listener;
li_2.onclick = listener;
li_3.onclick = listener;
};
2) Event delegation (better)
---------------------------------
function getTarget(e)
{
var target;
e = e || window.event;
// e.srcElement, is for IE
target = e.target || e.srcElement;
// old safari bug
if ( target.nodeType === 3 ) { target = target.parentNode; }
}
function listener(e)
{
var target = getTarget(e);
// we got a target and it's a LI
// not the more efficient way to detect, blah blah, yeah I know
if ( target && target.tagName.toUpperCase() == 'LI' )
{
alert(target.id);
return false;
}
return true;
}
window.onload = function()
{
var ul = document.getElementById('my_ul');
ul.onclick = listener;
};
Event delegation is the action of setting the listener on a parent of
the intended elements. It is very usefull especially when there is a lot
of child elements.
For example, let's assume the following <li> structure is repeated 50
times, it is, let's say, a listing of articles.
<li>
<a href="del.xxx?id=y" class="delete">delete</a>
<a href="upd.xxx?id=y" class="update">A label</a>
<a href="ac1.xxx?id=y" class="action1">do action 1</a>
<a href="ac2.xxx?id=y" class="action2">do action 2</a>
<a href="ac3.xxx?id=y" class="action3">do action 3</a>
</li>
Once we have 50 of thoses <li>, we have to transform the <a href="..">
to the matching XHR action, don't ask why, it is for the example.
Simple way is to loop the <li>, get the <a> elements on every of them
and add the javascript listener. Which result into 50 <li> multiply 5
<a> = 250 listeners in the document.
It will be more efficient to add a single (one) listener on the <ul>
which will delegate the click to the various <a>
I bet I am not very clear, especially in english, feel free to ask more
information about event delegation I may try to explain more clearly
(doubtfull) but I'm sure people knowing much better than me will
explain it in an easier way.
--
laurent
|
|
0
|
|
|
|
Reply
|
Laurent
|
11/30/2008 5:27:22 PM
|
|
Laurent vilday :
> function getTarget(e)
> {
> var target;
> e = e || window.event;
> // e.srcElement, is for IE
> target = e.target || e.srcElement;
> // old safari bug
> if ( target.nodeType === 3 ) { target = target.parentNode; }
> }
Oups, my bad, should of course be :
function getTarget(e)
{
var target = null;
e = e || window.event;
// e.srcElement, is for IE
target = e.target || e.srcElement;
// old safari bug
if ( target && target.nodeType === 3 ) { target = target.parentNode; }
return target;
}
--
laurent
|
|
0
|
|
|
|
Reply
|
Laurent
|
11/30/2008 5:35:50 PM
|
|
On 2008-11-30 17:28, Conrad Lender wrote:
> document with ~2000 (normal sized) lines will be decompressed in memory
> in a matter of microseconds or less.
s/micro/milli/
- Conrad
|
|
0
|
|
|
|
Reply
|
Conrad
|
11/30/2008 5:43:43 PM
|
|
Le 11/30/08 5:46 PM, Laurent vilday a �crit :
Salut Laurent,
> SAM :
>>
>> with a bit of code I would better understand.
>
> Instead of :
> Au lieu de :
Ha! enfin quelqu'un qui m'�vitera de googleiser l'anglais que
j'interpr�te mal :-)
Ha! somebody speaking french and english.
> function see(what) {
> what.className = what.className==''? 'show' : '';
> }
> [...]
> for(var i=0; i<n; i++) {
> d[i].onmouseover = function() { see(this); };
> d[i].onmouseout = function() { see(this); };
> }
>
> You should do something like (probably not exactly what David meant, but
> hey, I do what I can with provided rants :) :
> Tu devrais faire quelque chose comme ceci (probablement pas exactement
> ce que David voulais dire, mais hey, je fais ce que je peux avec les
> coups de gueules fournis :) :
It's almost what I finally did.
> function see(e/*the event useless here*/)
> {
> this.className = this.className == '' ? 'show' : '';
> }
> [...]
> for ( var i = 0; i < n; i++ )
> {
except there ... where the listener will do the job.
> d[i].onmouseover = see;
> d[i].onmouseout = see;
> }
And now I have trouble with that listener I've found somewhere, and as I
know you're a chief about that, code can be found here :
<http://cjoint.com/?lEs6Hv73eQ>
see : function addEvent()
that seems to me very complicated about attachEvent
spending 4 seconds in my IE.6 against 0.2 seconds in my FF.3
Faudrait que je pense � r�cup�rer les "trucs" sur mokhet, d�j� que
'molette' n'y est plus ;-)
Nota :
I've tried to use 'this' for a function harder than see()
and the 'this' in the function returns 'Object Window' instead of the
object getting the event.
<div onmouseover="fly()">
blah
</div>
function fly(e) {
alert(this); // [object Window]
var f = this.getElementsByTagName('dl')[0].cloneNode(true);
// error
// this.getE... is not a function
// blah
}
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
11/30/2008 6:18:13 PM
|
|
On Nov 30, 7:18=A0pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
>
> Nota :
> I've tried to use 'this' for a function harder than see()
> and the 'this' in the function returns 'Object Window' instead of the
> object getting the event.
>
> <div onmouseover=3D"fly()">
> =A0 =A0 blah
> </div>
>
> function fly(e) {
> alert(this); =A0// [object Window]
> var f =3D this.getElementsByTagName('dl')[0].cloneNode(true);
> =A0 =A0 =A0// error
> =A0 =A0 =A0// this.getE... is not a function
>
> // blah
>
> }
Sam,
<div onmouseover=3D "fly()">
turns ~into:
div.onmouseover=3D function () {
fly();
};
IIRC, to get around that, you can write:
<div onmouseover=3D "fly(this)">
It will turn ~into:
div.onmouseover=3D function () {
fly(this);
};
So that you'll get the proper "this" as the 1st parameter (whatever
its name) in your "fly" function:
function fly (p) {
//use "p" instead of "this"
alert(p);
var f=3D p.getElementsByTagName('dl')[0].cloneNode(true);
//etc.
}
--
Jorge.
|
|
0
|
|
|
|
Reply
|
Jorge
|
11/30/2008 6:37:32 PM
|
|
Le 11/30/08 6:27 PM, Laurent vilday a �crit :
> SAM :
>> David Mark :
>>> SAM :
>>>>> Use one listener for things like this. Delegate based on the event
>>>>> target. And don't create memory leaks.
>>>> OK, I will try.
>>>> Just I don't remember how to do.
>>>
>>> I gave you a link.
>>
>> About listener and events ?
>
> St�phane, arr�tes de me faire rire STP, je sais que tu sais :)
Je t'assure que je ne comprends rien � ce que me veut ce Mark.
Avec le barrage de la langue s'il ne donne pas des bouts de code pour
�clairer le propos, je ne trouve pas sa m�thode tr�s constructive.
With the barrier of language if David Mark does not give me snippets of
code to clarify the point, I can not find his method very constructive.
> Google : event delegation
(snip)
> It will be more efficient to add a single (one) listener on the <ul>
> which will delegate the click to the various <a>
Ho Yes ! seen like that, it is very useful.
I'll go to try and come back.
Don't move ;-)
Here it is :
<http://cjoint.com/?lEvswiroOX>
and seems to work well in IE.6 or FF.3
M'enfin, c'est quand m�me une sacr�e gymnastique, je trouve.
(<http://translate.google.com/translate_t#fr|en|M%27enfin%2C%20c%27est%20quand%20m%C3%AAme%20une%20sacr%C3%A9%20gymnastique%2C%20je%20trouve>)
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
11/30/2008 8:26:21 PM
|
|
Le 11/30/08 7:37 PM, Jorge a �crit :
> On Nov 30, 7:18 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
> wrote:
>> Nota :
>> I've tried to use 'this' for a function harder than see()
>> and the 'this' in the function returns 'Object Window' instead of the
>> object getting the event.
>
> Sam,
>
> <div onmouseover= "fly()">
>
> turns ~into:
>
> div.onmouseover= function () {
> fly();
> };
>
> IIRC, to get around that, you can write:
>
> <div onmouseover= "fly(this)">
It's what I had and what worked.
but ...
David Mark made me mad with his histories of memory leak and listener !
If I do :
<p id="here"> example </p>
<script type="text/javascript">
var a = document.getElementById('here');
if ( a.attachEvent ) {
a.attachEvent( "onmouseover", fly );
} else
a.addEventListener( "mouseover", fly, false );
function fly(e) { alert(this.innerHTML); }
</script>
where 'e' is not used and 'this' is dropped from I don't know where.
As, curiously, the unknown 'this' does the expected job,
I tried to do the same in "normal" html.
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
11/30/2008 8:57:02 PM
|
|
On Nov 30, 9:57=A0pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
>
> where 'e' is not used and 'this' is dropped from I don't know where.
>
> As, curiously, the unknown 'this' does the expected job,
> I tried to do the same in "normal" html.
>
Sam,
If/when the event handler function is assigned in JS code, such as in:
div.onclick=3D handler; or div.addEventListener('click', handler, true);
or Whatever it is in IE, then the "this" in the handler() function is
ok, it points to the element.
The problem comes when the handler is assigned in the .html in this
way:
<div onclick=3D"handler()"></div>
because it is *not* the same as div.onclick=3D handler; but div.onclick=3D
function () { handler(); };
Do you see the difference ?
Do you see why "this" gets lost ?
Salut,
--
Jorge.
|
|
0
|
|
|
|
Reply
|
Jorge
|
11/30/2008 9:18:40 PM
|
|
Le 11/30/08 10:18 PM, Jorge a �crit :
> On Nov 30, 9:57 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
> wrote:
>> where 'e' is not used and 'this' is dropped from I don't know where.
>>
>> As, curiously, the unknown 'this' does the expected job,
>> I tried to do the same in "normal" html.
>>
>
> Sam,
>
> If/when the event handler function is assigned in JS code, such as in:
>
> div.onclick= handler; or div.addEventListener('click', handler, true);
> or Whatever it is in IE, then the "this" in the handler() function is
> ok, it points to the element.
>
> The problem comes when the handler is assigned in the .html in this
> way:
>
> <div onclick="handler()"></div>
>
> because it is *not* the same as div.onclick= handler; but div.onclick=
> function () { handler(); };
>
> Do you see the difference ?
> Do you see why "this" gets lost ?
Where I get difficulties is with the other difference ;-)
from where 'this' gets something when :
div.onclick= handler;
I've so difficulties with prototypes
that forces too much my poor last neurone trying to follow what happens
> Salut,
Hola ;-)
� Me encanta tu script 'blob' absolutamente !
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
11/30/2008 9:33:52 PM
|
|
On Nov 30, 7:21=A0am, Jorge <jo...@jorgechamorro.com> wrote:
> On Nov 30, 12:04=A0pm, David Mark <dmark.cins...@gmail.com> wrote:
>
>
>
> > The DOM cannot be considered "ready" at this point. =A0And all of the
> > elements are not in place. =A0The body hasn't even closed. =A0Google
> > "Operation Aborted" and IE.
>
> Well, that you can't append to the body does not mean that the
> (already, previously) parsed html elements aren't in-place. They are.
That's not what I said. I said the body hasn't closed.
> In any case, if you want to be able to append to the (not yet closed)
> body tag just wrap the script into a setTimeout( ,0). That's all:
That is still no guarantee that adding a child to the body will work
(may in fact throw "Operation Aborted.")
[snip]
|
|
0
|
|
|
|
Reply
|
David
|
11/30/2008 9:42:11 PM
|
|
On Nov 30, 10:50=A0am, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
> Le 11/30/08 2:18 AM, David Mark a =E9crit :
>
> > On Nov 29, 6:25 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
> > wrote:
>
> >>>> function see(what) {
> >>> =A0 what.className =3D what.className=3D=3D''? 'show' : '';
> >>> =A0 }
> >>> The "what" argument is unnecessary and foreshadows a bigger problem.
> >> Some light about the bigger problem ?
>
> > As mentioned, memory leaks. =A0See below.
>
> >> If no argument, what do you propose ?
>
> > Using the "this" identifier in the listener.
>
> with a bit of code I would better understand.
>
> >>> =A0 // is it IE ?
> >>> =A0 var IE =3D false; /*@cc_on IE =3D true @*/
> >>> Needless. =A0Use CC only when necessary (virtually never.)
>
> >> As some browsers accept document.all when in same time they prefer gEB=
I
> >> I use CC to be sure to speak exclusively to IE (unlovely that catches =
IE
> >> Mac too).
>
> > Which is silly. =A0Always test the standard (gEBI in this case) first,
> > then you won't have a problem.
>
> No that's wrong : gEBI is understood by IE and
> in my test I want to use exclusively =A0document.all
> (and only if the browser is really IE)
That is ridiculous.
>
> see what M$ says :
> <http://msdn.microsoft.com/en-us/library/ms537630(VS.85).aspx>
> ... the less worst being conditional comments :-(
Irrelevant.
>
> >>> It needs gEBTN, appendChild, cloneNode and the non-standard innerHTML
> >>> property just to get started, but detects nothing.
> >> The non-standard innerHTML is de facto a standard if used knowing what
> >> it does.
>
> > No matter. =A0Is isn't needed for this and you didn't test it (or
> > anything else.)
>
> what for ?
> its just a demo to see time spending to run through DOM
>
> The JS copy-clone was only to do not copy-paste manually 200 divs
> (ang going back on each of them to correct IDs ans texts).
If you post it here, it should at least be competent. The feature
detection is the least of the worries at the moment.
>
> >> What do you want it detects ? (what is "it" ?)
> >> maybe : getElementsByTagName ?
>
> > That would be a start.
>
> As I'am targeting at worst IE6 ... doest it really matter ?
And you want it to crash in older browsers?
>
> >> Can you give me a detection will ensure that the browser is IE
> >> and *only* IE ?
>
> > That isn't what you are trying to detect here. =A0You want to know if
> > you can use document.all without throwing an exception, so you should
> > detect document.all (only after testing gEBI.)
>
> Once more : no, you're wrong.
> I want to detect "IE" and not if the browser is able to do this or that.
And why would you want to do that? It makes no sense.
>
> >>> =A0 =A0 =A0var d =3D document.all, n =3D d.length;
>
> > Right there it will blow up if some new version of IE eliminates
> > document.all.
>
> Once more it's to try "document.all" (with actual IEs of course).
> Why to pass time to test other obscure and not yet born features ?
>
> Anyway in 30 days the demo-test will be deleted (does M$ expects to
> offer a new IE in this delay ?)
Never mind all of this. Did you fix the leaks?
>
> >>> Needless inner functions, which also create circular references
> >>> involving elements.
> >> I asked Google to help me understand your sentence in pure pain
>
> > I know the feeling.
>
> Google translates 'needless' by 'it' ... :-(
Okay.
>
> >> (Needless inner functions ?)
>
> > Yes. =A0Hark back to the "what" argument.
>
> Could you code something as example ?
> (so I can understand where could be or not the circular ref)
> (perhaps ?)
Just lose the extra functions.
>
> >>>http://www.jibbering.com/faq/faq_notes/closures.html#clMem
> >> Je ne comprends rien aux closures, il n'y a pas de mot francais pour e=
n
> >> traduire le sens.
> >> I definitively understand nothing about closures.
> >> Isn't it enough to close the page to leave the closure ?
>
> > What are you doing creating closures if you know nothing about them?
>
> Why do you laugh at me like that ?
I am not laughing at you. It is a serious question.
[snip]
>
> > You are wrong. =A0No argument =3D no inner function =3D no closure =3D =
no
> > circular reference =3D no memory leak.
>
> I begin vaguely to understand (outer function getting inner functions's
> variable I think I rode)
> Can 'this' be seen as an inner-outer-variable ?
> in :
>
> =A0 =A0foo.onmouseover =3D function() {see(this);};
>
> which is a so often used way by programmers.
>
> Would it be better (and is it possible ?) to do :
>
> =A0 =A0foo.omouseover =3D 'see(this)';
> =A0 =A0foo.omouseover =3D 'see(e)';
> =A0 =A0foo.omouseover =3D see;
The last one (the first two are nonsense.) And guess what "this" will
refer to in the listener?
>
> >>> And lots of memory leaked.
> >> Pas grave, il doit en rester.
>
> > Do you mind? =A0I don't speak French.
>
> Didn't I see you spoke Spanish ?
Well, I suppose Spanish and French are roughly the same. And don't
believe everything you see (I don't speak Spanish.)
>
> >> With UC that have in this time 2Go and more memory, what could do a
> >> little leak like that ?
>
> > Open your task manager and find out.
>
> ??? on My Mac ?
Obviously not.
> sure I'll find a task manager for IE.linux runing under X11 ;-)
So fix your code and forget it (or get a Windows machine.)
>
> >> Have I to put in my pages a button to relaunch Windows ?
>
> > No, you need to learn to write proper scripts.
>
> I wait you for the corrections and not only : "do not do that"
>
> >>> Use one listener for things like this. =A0Delegate based on the event
> >>> target. =A0And don't create memory leaks.
> >> OK, I will try.
> >> Just I don't remember how to do.
>
> > I gave you a link.
>
> About listener and events ?
No, about memory leaks.
[snip]
|
|
0
|
|
|
|
Reply
|
David
|
11/30/2008 9:55:32 PM
|
|
On Nov 30, 11:46=A0am, Laurent vilday <mok...@mokhet.com> wrote:
> SAM :
>
>
>
> > David Mark :
> >> SAM :
>
> >>>>> function see(what) {
> >>>> =A0 what.className =3D what.className=3D=3D''? 'show' : '';
> >>>> =A0 }
> >>>> The "what" argument is unnecessary and foreshadows a bigger problem.
> >>> Some light about the bigger problem ?
>
> >> As mentioned, memory leaks. =A0
>
> >>> If no argument, what do you propose ?
>
> >> Using the "this" identifier in the listener.
>
> > with a bit of code I would better understand.
>
> Instead of :
> Au lieu de :
>
> function see(what) {
> =A0 what.className =3D what.className=3D=3D''? 'show' : '';}
>
> [...]
> for(var i=3D0; i<n; i++) {
> =A0 d[i].onmouseover =3D function() { see(this); };
> =A0 d[i].onmouseout =3D function() { see(this); };
>
> }
>
> You should do something like (probably not exactly what David meant, but
> hey, I do what I can with provided rants :) :
> Tu devrais faire quelque chose comme ceci (probablement pas exactement
> ce que David voulais dire, mais hey, je fais ce que je peux avec les
> coups de gueules fournis :) :
Again with the French.
>
> function see(e/*the event useless here*/)
> {
> =A0 this.className =3D this.className =3D=3D '' ? 'show' : '';}
>
> [...]
> for ( var i =3D 0; i < n; i++ )
> {
> =A0 d[i].onmouseover =3D see;
> =A0 d[i].onmouseout =3D see;
>
> }
That is what I meant (partly.) That fixes the memory leaks and stops
the creation of thousands of useless function objects.
[snip]
|
|
0
|
|
|
|
Reply
|
David
|
11/30/2008 9:59:02 PM
|
|
On Nov 30, 12:35=A0pm, Laurent vilday <mok...@mokhet.com> wrote:
> Laurent vilday :
>
> > function getTarget(e)
> > {
> > =A0var target;
> > =A0e =3D e || window.event;
> > =A0// e.srcElement, is for IE
> > =A0target =3D e.target || e.srcElement;
> > =A0// old safari bug
> > =A0if ( target.nodeType =3D=3D=3D 3 ) { target =3D target.parentNode; }
> > }
>
> Oups, my bad, should of course be :
>
> function getTarget(e)
> {
> =A0 var target =3D null;
> =A0 e =3D e || window.event;
> =A0 // e.srcElement, is for IE
> =A0 target =3D e.target || e.srcElement;
> =A0 // old safari bug
It is not a bug, nor is it specific to Safari (e.g. NN6.2 does this.)
> =A0 if ( target && target.nodeType =3D=3D=3D 3 ) { target =3D
You don't need a strict comparison for this. But at least you didn't
sniff for Safari (like jQuery.)
[snip]
|
|
0
|
|
|
|
Reply
|
David
|
11/30/2008 10:02:36 PM
|
|
On Nov 30, 10:42=A0pm, David Mark <dmark.cins...@gmail.com> wrote:
>
> That is still no guarantee that adding a child to the body will work
> (may in fact throw "Operation Aborted.")
>
Why ? The closing body tag will have been parsed by then.
(Anybody else hates IE as much as I do ?)
--
Jorge.
|
|
0
|
|
|
|
Reply
|
Jorge
|
11/30/2008 10:08:46 PM
|
|
On Nov 30, 3:57=A0pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
> Le 11/30/08 7:37 PM, Jorge a =E9crit :
>
>
>
> > On Nov 30, 7:18 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
> > wrote:
> >> Nota :
> >> I've tried to use 'this' for a function harder than see()
> >> and the 'this' in the function returns 'Object Window' instead of the
> >> object getting the event.
>
> > Sam,
>
> > <div onmouseover=3D "fly()">
>
> > turns ~into:
>
> > div.onmouseover=3D function () {
> > =A0 fly();
> > };
>
> > IIRC, to get around that, you can write:
>
> > <div onmouseover=3D "fly(this)">
>
> It's what I had and what worked.
But, you attached the listeners with script, creating a closure and
leaking lots of memory in the process.
>
> but ...
> David Mark made me mad with his histories of memory leak and listener !
Sorry for any inconvenience.
>
> If I do :
>
> <p id=3D"here"> example </p>
>
> <script type=3D"text/javascript">
>
> var a =3D document.getElementById('here');
> if ( a.attachEvent ) {
> =A0 =A0 =A0a.attachEvent( "onmouseover", fly );
> =A0 =A0} else
> =A0 =A0 =A0a.addEventListener( "mouseover", fly, false );
>
> function fly(e) { alert(this.innerHTML); }
> </script>
You could have used DOM0 as before.
>
> where 'e' is not used and 'this' is dropped from I don't know where.
IE doesn't set "this" properly when using attachEvent.
|
|
0
|
|
|
|
Reply
|
David
|
11/30/2008 10:09:37 PM
|
|
On Nov 30, 10:33=A0pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
>
> from where 'this' gets something when :
>
> =A0 =A0div.onclick=3D handler;
>
var anObject=3D {};
var handler=3D function () { alert(this); }
anObject.onclick=3D handler;
handler(); //alerts window.
anObject.onclick(); //alerts anObject
See "Objects and this" in: http://javascript.crockford.com/survey.html
> =A1 Me encanta tu script 'blob' absolutamente !
You can get a copy and use it freely if you want to.
Salut,
--
Jorge.
|
|
0
|
|
|
|
Reply
|
Jorge
|
11/30/2008 10:29:12 PM
|
|
Le 11/30/08 10:55 PM, David Mark a �crit :
> On Nov 30, 10:50 am, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
> wrote:
>> Le 11/30/08 2:18 AM, David Mark a �crit :
>>
>>> Which is silly. Always test the standard (gEBI in this case) first,
>>> then you won't have a problem.
>> No that's wrong : gEBI is understood by IE and
>> in my test I want to use exclusively document.all
>> (and only if the browser is really IE)
>
> That is ridiculous.
Not from my side.
If it is what I want, why to say 'ridiculous' ?
>> The JS copy-clone was only to do not copy-paste manually 200 divs
>> (ang going back on each of them to correct IDs ans texts).
>
> If you post it here, it should at least be competent.
Yes and no.
You're there to verify ;-)
> The feature detection is the least of the worries at the moment.
We'll say so.
It's too hard for me fighting in english.
>>>> What do you want it detects ? (what is "it" ?)
>>>> maybe : getElementsByTagName ?
>>> That would be a start.
>> As I'am targeting at worst IE6 ... doest it really matter ?
>
> And you want it to crash in older browsers?
Yeap, that's of no interest here.
(I defended a long time NN4 ago not so far, today I do not more)
>> I want to detect "IE" and not if the browser is able to do this or that.
>
> And why would you want to do that? It makes no sense.
I did explain it.
break;
>> Anyway in 30 days the demo-test will be deleted (does M$ expects to
>> offer a new IE in this delay ?)
>
> Never mind all of this. Did you fix the leaks?
I tried :-)
(even if I continue to do not well understand what it is)
>> Didn't I see you spoke Spanish ?
>
> Well, I suppose Spanish and French are roughly the same.
No, not so much.
As if you could say that Dutch and English are almost same.
> And don't believe everything you see (I don't speak Spanish.)
Well, I confusing, perhaps?
> So fix your code and forget it (or get a Windows machine.)
Certainly not !
To see all the memory melt like snow in the sun?
:-)
SYS
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
11/30/2008 10:48:23 PM
|
|
Le 11/30/08 10:59 PM, David Mark a �crit :
> On Nov 30, 11:46 am, Laurent vilday <mok...@mokhet.com> wrote:
>> You should do something like (probably not exactly what David meant, but
>> hey, I do what I can with provided rants :) :
>> Tu devrais faire quelque chose comme ceci (probablement pas exactement
>> ce que David voulais dire, mais hey, je fais ce que je peux avec les
>> coups de gueules fournis :) :
>
> Again with the French.
Lovely !
And you got the simultaneous translation, happy guy.
> That is what I meant (partly.) That fixes the memory leaks and stops
> the creation of thousands of useless function objects.
OK.
But that was not my interest at this time.
Since, with Laurent's help, I've progressed (I hope !)
And now I have a single listener for all the body.
And ... it seems to work too with IE.6.
That even works very very well !
No more time to spend looping the divs to set with events, after loading.
I do not understand very well why you didn't give the solution when the
philosopher was running in circle around his divs to show and hide ?
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
11/30/2008 11:00:23 PM
|
|
Le 11/30/08 11:09 PM, David Mark a �crit :
> On Nov 30, 3:57 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
> wrote:
>>> <div onmouseover= "fly(this)">
>> It's what I had and what worked.
>
> But, you attached the listeners with script, creating a closure and
> leaking lots of memory in the process.
It was not in that test (I think, I did so much !)
But no importance, I'll try to remember this problem (trouble ?).
>> If I do :
>>
>> <p id="here"> example </p>
>>
>> <script type="text/javascript">
>>
>> var a = document.getElementById('here');
>> if ( a.attachEvent ) {
>> a.attachEvent( "onmouseover", fly );
>> } else
>> a.addEventListener( "mouseover", fly, false );
>>
>> function fly(e) { alert(this.innerHTML); }
>> </script>
>
> You could have used DOM0 as before.
Yes, perhaps, probably, certainly, surely, but it was not the purpose.
>> where 'e' is not used and 'this' is dropped from I don't know where.
>
> IE doesn't set "this" properly when using attachEvent.
IE est une bouse qui nous emmerde tous, tout le monde sait �a.
No, I will not say it in English.
IE has do to what it can, if it can.
Reverse bubbling, leaks of memory, Jscript and so on without end.
Sometimes, surely by chance, some features work with it as with other
browsers.
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
11/30/2008 11:27:27 PM
|
|
On Nov 30, 5:48=A0pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
> Le 11/30/08 10:55 PM, David Mark a =E9crit :
>
> > On Nov 30, 10:50 am, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
> > wrote:
> >> Le 11/30/08 2:18 AM, David Mark a =E9crit :
>
> >>> Which is silly. =A0Always test the standard (gEBI in this case) first=
,
> >>> then you won't have a problem.
> >> No that's wrong : gEBI is understood by IE and
> >> in my test I want to use exclusively =A0document.all
> >> (and only if the browser is really IE)
>
> > That is ridiculous.
>
> Not from my side.
> If it is what I want, why to say 'ridiculous' ?
It just is.
>
> >> The JS copy-clone was only to do not copy-paste manually 200 divs
> >> (ang going back on each of them to correct IDs ans texts).
>
> > If you post it here, it should at least be competent.
>
> Yes and no.
> You're there to verify ;-)
>
> > =A0The feature detection is the least of the worries at the moment.
>
> We'll say so.
> It's too hard for me fighting in english.
>
> >>>> What do you want it detects ? (what is "it" ?)
> >>>> maybe : getElementsByTagName ?
> >>> That would be a start.
> >> As I'am targeting at worst IE6 ... doest it really matter ?
>
> > And you want it to crash in older browsers?
>
> Yeap, that's of no interest here.
> (I defended a long time NN4 ago not so far, today I do not more)
Who is talking about NN4?
>
> >> I want to detect "IE" and not if the browser is able to do this or tha=
t.
>
> > And why would you want to do that? =A0It makes no sense.
>
> I did explain it.
Not really.
> =A0 break;
>
> >> Anyway in 30 days the demo-test will be deleted (does M$ expects to
> >> offer a new IE in this delay ?)
>
> > Never mind all of this. =A0Did you fix the leaks?
>
> I tried :-)
> (even if I continue to do not well understand what it is)
Okay.
>
> >> Didn't I see you spoke Spanish ?
>
> > Well, I suppose Spanish and French are roughly the same.
>
> No, not so much.
> As if you could say that Dutch and English are almost same.
I was being facetious.
>
> > And don't believe everything you see (I don't speak Spanish.)
>
> Well, I confusing, perhaps?
Yes.
>
> > So fix your code and forget it (or get a Windows machine.)
>
> Certainly not !
> To see all the memory melt like snow in the sun?
> =A0 :-)
No, to test your leaky code.
[snip]
|
|
0
|
|
|
|
Reply
|
David
|
11/30/2008 11:32:43 PM
|
|
On Nov 30, 6:00=A0pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
> Le 11/30/08 10:59 PM, David Mark a =E9crit :
>
> > On Nov 30, 11:46 am, Laurent vilday <mok...@mokhet.com> wrote:
> >> You should do something like (probably not exactly what David meant, b=
ut
> >> hey, I do what I can with provided rants :) :
> >> Tu devrais faire quelque chose comme ceci (probablement pas exactement
> >> ce que David voulais dire, mais hey, je fais ce que je peux avec les
> >> coups de gueules fournis :) :
>
> > Again with the French.
>
> Lovely !
> And you got the simultaneous translation, happy guy.
And how would I know it is a translation?
>
> > That is what I meant (partly.) =A0That fixes the memory leaks and stops
> > the creation of thousands of useless function objects.
>
> OK.
> But that was not my interest at this time.
Whether it is your interest or not is irrelevant. You posted a very
faulty example.
>
> Since, with Laurent's help, I've progressed (I hope !)
> And now I have a single listener for all the body.
The body seems an odd choice.
> And ... it seems to work too with IE.6.
>
> That even works very very well !
Glad you approve.
> No more time to spend looping the divs to set with events, after loading.
There you go.
>
> I do not understand very well why you didn't give the solution when the
> philosopher was running in circle around his divs to show and hide ?
The "philosopher" is constantly going around in circles as he refuses
to learn anything.
[snip]
|
|
0
|
|
|
|
Reply
|
David
|
11/30/2008 11:37:09 PM
|
|
Le 11/30/08 11:29 PM, Jorge a �crit :
>
> See "Objects and this" in: http://javascript.crockford.com/survey.html
Outch ! My god ! to read Crockford in the text ?
I use 'object' and 'this' sometimes, but there it was a little went out
from usual context.
>> � Me encanta tu script 'blob' absolutamente !
>
> You can get a copy and use it freely if you want to.
Don't worry it was made, and I show it from time to time.
(I'm not yet ready to imagine all those mathematical functions with
gravity and so funny abstractions)
(with my poor last neurone you know)
(tremendous where is it ?)
Chiao
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
11/30/2008 11:45:42 PM
|
|
Le 12/1/08 12:32 AM, David Mark a �crit :
> On Nov 30, 5:48 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
> wrote:
>> (I defended a long time NN4 ago not so far, today I do not more)
>
> Who is talking about NN4?
L� tu commences � m'�nerver grave !
You begin to put me out of my nerves.
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
11/30/2008 11:49:33 PM
|
|
Le 12/1/08 12:37 AM, David Mark a �crit :
> On Nov 30, 6:00 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
> wrote:
>> Le 11/30/08 10:59 PM, David Mark a �crit :
>>
>>> Again with the French.
>> Lovely !
>> And you got the simultaneous translation, happy guy.
>
> And how would I know it is a translation?
Google ? Yahoo! ? <http://www.lexilogos.com/english/translation.htm> ?
for example.
>> But that was not my interest at this time.
>
> Whether it is your interest or not is irrelevant. You posted a very
> faulty example.
So sorry.
>> I do not understand very well why you didn't give the solution when the
>> philosopher was running in circle around his divs to show and hide ?
>
> The "philosopher" is constantly going around in circles as he refuses
> to learn anything.
Do you think ? He says he's a good programmer, no ?
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
11/30/2008 11:56:16 PM
|
|
David Mark :
> Laurent vilday :
>> Oups, my bad, should of course be :
>>
>> function getTarget(e)
>> {
>> var target = null;
>> e = e || window.event;
>> // e.srcElement, is for IE
>> target = e.target || e.srcElement;
>> // old safari bug
>
> It is not a bug, nor is it specific to Safari (e.g. NN6.2 does this.)
Well, that is just a comment in a not tested code after all. At least I
knew the behavior (target is the text node and not the element node as
expected) is exposed by Safari so I though with this little comment I
could help readers to not spend hours to find out why this undesirable
behavior is happening.
>> if ( target && target.nodeType === 3 ) { target =
>
> You don't need a strict comparison for this. But at least you didn't
> sniff for Safari (like jQuery.)
I *never* sniff. However I agree with the ===, but it looks like micro
optimisation to me, not really important.
--
laurent
|
|
0
|
|
|
|
Reply
|
Laurent
|
12/1/2008 12:06:21 AM
|
|
On Nov 30, 6:49=A0pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
> Le 12/1/08 12:32 AM, David Mark a =E9crit :
>
> > On Nov 30, 5:48 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
> > wrote:
> >> (I defended a long time NN4 ago not so far, today I do not more)
>
> > Who is talking about NN4?
>
> L=E0 tu commences =E0 m'=E9nerver grave !
> You begin to put me out of my nerves.
>
The fact remains that NN4 has no bearing here.
[snip]
|
|
0
|
|
|
|
Reply
|
David
|
12/1/2008 12:44:03 AM
|
|
On Nov 30, 6:56=A0pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
> Le 12/1/08 12:37 AM, David Mark a =E9crit :
>
> > On Nov 30, 6:00 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
> > wrote:
> >> Le 11/30/08 10:59 PM, David Mark a =E9crit :
>
> >>> Again with the French.
> >> Lovely !
> >> And you got the simultaneous translation, happy guy.
>
> > And how would I know it is a translation?
>
> Google ? Yahoo! ? <http://www.lexilogos.com/english/translation.htm> ?
> for example.
>
> >> But that was not my interest at this time.
>
> > Whether it is your interest or not is irrelevant. =A0You posted a very
> > faulty example.
>
> So sorry.
>
> >> I do not understand very well why you didn't give the solution when th=
e
> >> philosopher was running in circle around his divs to show and hide ?
>
> > The "philosopher" is constantly going around in circles as he refuses
> > to learn anything.
>
> Do you think ? He says he's a good programmer, no ?
No. He can say he's the Queen of Sheba, but that doesn't make it so.
|
|
0
|
|
|
|
Reply
|
David
|
12/1/2008 12:45:37 AM
|
|
On Nov 30, 7:06=A0pm, Laurent vilday <mok...@mokhet.com> wrote:
> David Mark :
>
> > Laurent vilday :
> >> Oups, my bad, should of course be :
>
> >> function getTarget(e)
> >> {
> >> =A0 var target =3D null;
> >> =A0 e =3D e || window.event;
> >> =A0 // e.srcElement, is for IE
> >> =A0 target =3D e.target || e.srcElement;
> >> =A0 // old safari bug
>
> > It is not a bug, nor is it specific to Safari (e.g. NN6.2 does this.)
>
> Well, that is just a comment in a not tested code after all. At least I
> knew the behavior (target is the text node and not the element node as
> expected) is exposed by Safari so I though with this little comment I
> could help readers to not spend hours to find out why this undesirable
> behavior is happening.
And if you adjust it slightly, it won't be misleading.
[snip]
|
|
0
|
|
|
|
Reply
|
David
|
12/1/2008 12:46:58 AM
|
|
On 2008-12-01 00:27, SAM wrote:
>> IE doesn't set "this" properly when using attachEvent.
>
> IE est une bouse qui nous emmerde tous, tout le monde sait ça.
> No, I will not say it in English.
It would be lost in translation anyway, there's no equivalent for
emmerder in English. "It encraps us all", perhaps? ... nah, doesn't
have the same ring to it :-)
> IE has do to what it can, if it can.
> Reverse bubbling, leaks of memory, Jscript and so on without end.
> Sometimes, surely by chance, some features work with it as with other
> browsers.
Yeah well, all this isn't exactly news. You're the one who wanted to
write a script *only* for IE. Usually, the value of 'this' in handlers
attached by attachEvent is rarely a problem, because you need wrapper
functions for cross-browser event handling anyway. From the wrapper you
can pass the source node to the handler in an argument, no big deal.
- Conrad
|
|
0
|
|
|
|
Reply
|
Conrad
|
12/1/2008 12:53:32 AM
|
|
Le 12/1/08 1:44 AM, David Mark a �crit :
> On Nov 30, 6:49 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
> wrote:
>> Le 12/1/08 12:32 AM, David Mark a �crit :
>>
>>> On Nov 30, 5:48 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
>>> wrote:
>>>> (I defended a long time NN4 ago not so far, today I do not more)
>>> Who is talking about NN4?
>> L� tu commences � m'�nerver grave !
>> You begin to put me out of my nerves.
>>
>
> The fact remains that NN4 has no bearing here.
Yes, and then ?
Why couldn't I speak about NN4 ?
That you juge the code of other, is a point.
That you juge of what others are speaking is another point.
I can try to believe you know something about JS (I don't realy know,
did I see a line of code from you ?)
but I can't admit you are alone to say of what we have to talk.
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
12/1/2008 1:00:26 AM
|
|
Conrad Lender :
> SAM :
>>> IE doesn't set "this" properly when using attachEvent.
>> IE est une bouse qui nous emmerde tous, tout le monde sait ça.
>> No, I will not say it in English.
>
> It would be lost in translation anyway, there's no equivalent for
> emmerder in English. "It encraps us all", perhaps? ... nah, doesn't
> have the same ring to it :-)
I would translate it to :
IE is crap screwing us all, everybody knows it.
or perhaps something like :
IE is a fucking horse, everybody knows it.
So many way to say it anyway :)
--
laurent
|
|
0
|
|
|
|
Reply
|
Laurent
|
12/1/2008 1:09:46 AM
|
|
Le 12/1/08 1:53 AM, Conrad Lender a écrit :
> On 2008-12-01 00:27, SAM wrote:
>
>> IE has do to what it can, if it can.
>> Reverse bubbling, leaks of memory, Jscript and so on without end.
>> Sometimes, surely by chance, some features work with it as with other
>> browsers.
>
> Yeah well, all this isn't exactly news.
No, surely.
Mais ça fait du bien.
> You're the one who wanted to write a script *only* for IE.
It was to see what it does with certain routine.
A kind of exercise.
Probably what could cause trouble is that in my test I've also dDBI
(but only where I'ven't to test IE)
David Mark seems to pose himself in defender of "good coding" (without
never showing a simple bit of code) and without any consideration of the
context. And it begins to be tiring.
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
12/1/2008 1:12:15 AM
|
|
David Mark :
> Laurent vilday :
>> David Mark :
>>> Laurent vilday :
>>>> Oups, my bad, should of course be :
>>>> function getTarget(e)
>>>> {
>>>> var target = null;
>>>> e = e || window.event;
>>>> // e.srcElement, is for IE
>>>> target = e.target || e.srcElement;
>>>> // old safari bug
>>> It is not a bug, nor is it specific to Safari (e.g. NN6.2 does this.)
>> Well, that is just a comment in a not tested code after all. At least I
>> knew the behavior (target is the text node and not the element node as
>> expected) is exposed by Safari so I though with this little comment I
>> could help readers to not spend hours to find out why this undesirable
>> behavior is happening.
>
> And if you adjust it slightly, it won't be misleading.
Do you mean adjusting a little comment line in a code *not* copy/pasted,
*not* tested, *not* intended to be executed ? I added this comment
because I though I would not have to argue over and over for the line
below the comment, if I know I would have refrain from posting at all.
All right, you win, you dick is way bigger than mine.
--
laurent
|
|
0
|
|
|
|
Reply
|
Laurent
|
12/1/2008 1:15:35 AM
|
|
On Nov 30, 8:12=A0pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
> Le 12/1/08 1:53 AM, Conrad Lender a =E9crit :
>
> > On 2008-12-01 00:27, SAM wrote:
>
> >> IE has do to what it can, if it can.
> >> Reverse bubbling, leaks of memory, Jscript and so on without end.
> >> Sometimes, surely by chance, some features work with it as with other
> >> browsers.
>
> > Yeah well, all this isn't exactly news.
>
> No, surely.
> Mais =E7a fait du bien.
>
> > You're the one who wanted to write a script *only* for IE.
>
> It was to see what it does with certain routine.
> A kind of exercise.
>
> Probably what could cause trouble is that in my test I've also dDBI
> (but only where I'ven't to test IE)
>
> David Mark seems to pose himself in defender of "good coding" (without
> never showing a simple bit of code) and without any consideration of the
Never showing a simple bit of code? A quick search of the archives
(or Google) will indicate otherwise.
> context. And it begins to be tiring.
You are lucky I mentioned those memory leaks, seeing as you were
completely unaware of the problem (or how to fix it.) Tiring or not,
looks like you might have learned something at this point.
|
|
0
|
|
|
|
Reply
|
David
|
12/1/2008 1:47:34 AM
|
|
On Nov 30, 8:15=A0pm, Laurent vilday <mok...@mokhet.com> wrote:
> David Mark :
[snip]
>
> All right, you win, you dick is way bigger than mine.
>
Now you are being sensible. But seriously, just adjust the comment
and/or your memory.
[snip]
|
|
0
|
|
|
|
Reply
|
David
|
12/1/2008 1:47:44 AM
|
|
Le 12/1/08 2:09 AM, Laurent vilday a écrit :
> Conrad Lender :
>> SAM :
>>>> IE doesn't set "this" properly when using attachEvent.
>>> IE est une bouse qui nous emmerde tous, tout le monde sait ça.
>>> No, I will not say it in English.
>>
>> It would be lost in translation anyway, there's no equivalent for
>> emmerder in English. "It encraps us all", perhaps? ... nah, doesn't
>> have the same ring to it :-)
Encraping, a real French specialty ! isn't it ?
> I would translate it to :
> IE is crap screwing us all, everybody knows it.
not too bad.
(I wouldn't find it)
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
12/1/2008 1:49:31 AM
|
|
Le 12/1/08 2:47 AM, David Mark a �crit :
> On Nov 30, 8:12 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
> wrote:
>
> Never showing a simple bit of code? A quick search of the archives
> (or Google) will indicate otherwise.
We'll say to me ?
And we'll stop here our incomprehension
OK ?
>> context. And it begins to be tiring.
>
> You are lucky I mentioned those memory leaks,
I thank you for that. And, certainly you'll have to do it again.
But your are tiring to do not explain what about you think or refer.
I meet in some NG another body who did as you do, it was also tiring
(a french NG, no wall of language).
> Tiring or not,
> looks like you might have learned something at this point.
Not yet, not yet. Just a drop of oil.
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
12/1/2008 1:59:39 AM
|
|
Le 12/1/08 2:47 AM, David Mark a �crit :
> On Nov 30, 8:15 pm, Laurent vilday <mok...@mokhet.com> wrote:
>> David Mark :
>
>> All right, you win, you dick is way bigger than mine.
>>
>
> Now you are being sensible.
Be careful, Laurent is very shy when he knows many things in JS.
That would damage it does not participate in contributions.
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
12/1/2008 2:05:22 AM
|
|
SAM wrote:
> Le 11/30/08 1:05 AM, The Natural Philosopher a �crit :
>> SAM wrote:
>>> Le 11/29/08 12:41 PM, The Natural Philosopher a �crit :
>>>> I raised this last week, and found a reasonable hack, but would like
>>>> to get a better solution, and hopefully a more elegant
>>>> solution..that runs a heck of a lot faster.
>>>>
>>>> basically its a flyout menu system,
>
> with 2000 items ... it's not more a menu !
> That's a dictionary !
>
Actually its a complete stock list from a small manufacturing company.
There are about 1000 items in it in about 50 categories organised as a
hierarchy. I need to be able to rapidly navigate this in order to create
assemblies of parts, and also to populate sales and purchase orders.
Rather than 'remember' every part number, or have to do a 'search' on
it., downloading the entire warehouse and its indices, was the fastest
way to do this. Each entry is very short tyext wise. Just teh name and
number of every part or index in teh databse.
>> Its a hierarchical tree menu. Elements are in pages
>> I call a flyout page a frame.
>
> Bon! me voil� bien avanc� !
> (flyout page ?)
>
Visual terms. A show/hide div containing a list of items. So category
'gearboxes' if you mouseover it pops up a square box containing lots of
different gearboxes as it were. And possibly another category 'gearbox
bearings' and so on. There is a need to identify all these sub boxes and
switch them on and off rapidly.
>> There are an indefinite amount of elements within each flyout page.
>
> ???? you'll have to limit this amount !
>
Thats limited only by the customer and how much stock he has. I can't go
to him and say 'er sorry, you cant stock more than 1000 items'
I MIGHT say, if you at stocking 10,000 you will need a very fast PC'
>> Each one is either a mouseover event that spawns yet another leaf,
>
> No, that's not possible.
> (except if by 'spawn' you mean 'show' something already existing,
> displayed)
>
Yes. Bien!
>> or a clickable entity, so each one is a div.
>
> No, why "so each one is a *DIV*" ?
> that could be an <ul> or a <dl>
> or do you mean a 'block' (a box, a container, also called layer) ?
>
Well its a div, rather than the above, for positioning/style purposes.
>> Perhaps it needn't be, but that makes absolute formatting easier.
>
> 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. I am not trying to be a nice HTML
site, I am trying to be an application that uses HTML and script as a
user interface, thats all.
>
>> It is extremely difficult to establish when one frame flys out, what
>> others should be canceled, so the
>
> The flyed frame gives a value to a global variable.
> Ne next flyer will close the opened one known by this variable then set
> it with itself one.
>
That's how I did it finally, yes.
>> The problem resolves to the simplest way of creating a substructure to
>> scan, that has pointers into only the relevant DOM elements that need
>> scanning.
>
> 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.
> It may be enough to drag the sub div details of the article in another
> unique div specialized to serve only viewing the wanted details as
> showed in my bad made previous examples.
>
> Why won't you use Json ?
Ive tried on occasion a few other peoples libraries and found them
extremely fragile, limited n vross browser support, and incable of dong
exactly waht I want.
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'
But there wasn't.
We could buy bits of it from various places, but none linked together.
I spent a year and $120,000 on the best I could fine.
Later on I realised that $120,000 was more than a years wages, and i
could have written it in a year.
Well, now I am. :-)
Using somewhat smarter terminals than the Wyse 50's and VT100's. They
are called web browsers. I am just using it as a smart terminal to
present forms for a database.
>
>> My hack is to register each frame as it is turned on by adding it to
>> an array of elements 'that have been turned on' and to turn off the
>> ones in that array solely.
>
> 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.
Plus at the time I started this, I was pretty ignorant about javascript
and the DOM, as you can see.
So the less javascript teh better was my initial assumption.
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!
>
>> I was just hoping that there might be a way to have that array loaded
>> at download time, but I don't see a simple way of passing a pointer to
>> a dom object before javascript actually runs, or, how to perform the
>> scan of the relevant elements efficiently at load time.
>
> forgive to have the page completely made in html
> leave the JS to complete from Json array each flyout on demand
>
Yeah. 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 and then adding the scripts to fill in values. Not that I
am, but its easier to debug CSS stuff than javascript. i have to look
for the optimal path through this, whih isn't always the most elegant.
Going all script makes it more elegant, but would require a months rewrite.
>>
>> function show (id) // expands a menu of this name at this level with
>> this parent id.
>
> OK or some
>
>>> is that an obligation to work only with divs ?
>>
>> Well, I am a goodish coder, but not a great javascripter, and DOMmer
>> and divs seemed the way to get entities that were absolutely
>> positioned, could take an ID, and could take mouse events. If you know
>> better, let me know..
>
> 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?
>>> and with "more than 2000" of them ?
>>
>> Yup. I am handling a stores with over 1000 items in about 30
>> categories, any one of which must be selectable. The code is generic,
>> but the screen I am working on is multi-level kitting, so I need to
>> both select a part - say 'box of chocolates' and craate an assembly
>> that says '2 caramel, three hazelnut, 1 cherry' and 'box' 'insert'
>> 'contents list' and '5 mins of packing labour' etc etc.
>
> with a small example it could be easiest to see the purpose.
>
>> So the need is to rapidly search through a very large number of
>> categories and actual items, to insert them in a data structure
>> representing 'the box of chocolates'
>
> I begin to see.
>
>> 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.
There's a reason for all this. The users - possibly remote - will
tolerate a slow page load, and a slow update of the database, but they
won't tolerate low navigation through the items.
The customer is thinking in terms of having a fairly slow link from a
laptop and mobile phone, to sell at trade shows and outdoor fairs.
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.
The particular form I am doing now wont ever be used on a slow link, so
its not crucial here, but the basic way of selecting parts may be, one
day next year ;-)
So as little traffic of a *regular* sort is the ideal; But one big
'update the sales database with 4k of insert'; is OK.
>>
>> I tried using straight <SEECT> <OPTION> but that only allowed a one
>> dimensional search and selecet, and was too clumsy to be functional.
>> The customer rejected it.
>>
>>> 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.
And, once switched on, to know waht to swith OFF, because I need to leve
various bits on as the mouse moves over the tree structure. I need to
leave the parent nodes on.
|
|
0
|
|
|
|
Reply
|
The
|
12/1/2008 11:21:09 AM
|
|
Conrad Lender wrote:
> On 2008-11-30 16:29, The Natural Philosopher wrote:
>> Its been and continues to be an interesting exercise in code
>> optimisation: On the one hand it may well be used on relatively low
>> bandwidth connections, and there compressing the HTML has reduced page
>> load times impressively (well, if the machine that decompresses has the
>> horsepower anyway) [...]
>>
>> I am not sure how the ZIP algorithm works, but it seems to be able to
>> turn 2000 lines of essentially almost identical information into not
>> very much at all.
> [...]
>> My biggests lag locally is now decompressing the page..about half a
>> second.
>
> If you're talking about HTTP compression, I highly doubt that. A
> document with ~2000 (normal sized) lines will be decompressed in memory
> in a matter of microseconds or less. Better look for the source of your
> lag elsewhere.
>
Ok, I will.
Actually I think you are probably right.
I suspect the lag is actually the browser assembling an awful lot of
elements and getting around to building the DOM itself.
Or perhaps its php taking time to compress..
> If you're curious about how ZIP works, the algorithm is described here:
> http://en.wikipedia.org/wiki/DEFLATE
>
Thanks. I will.
Anyway a manual zipping of the source suggest at 5:1 reduction or
thereabouts.
From around about a second of download time to about 200ms, on a slow
link.
Thats good enough.
>
> - Conrad
|
|
0
|
|
|
|
Reply
|
The
|
12/1/2008 11:25:00 AM
|
|
Jorge wrote:
> On Nov 30, 10:42 pm, David Mark <dmark.cins...@gmail.com> wrote:
>> That is still no guarantee that adding a child to the body will work
>> (may in fact throw "Operation Aborted.")
>>
>
> Why ? The closing body tag will have been parsed by then.
>
> (Anybody else hates IE as much as I do ?)
>
More, if its possible.
> --
> Jorge.
|
|
0
|
|
|
|
Reply
|
The
|
12/1/2008 11:28:04 AM
|
|
"The Natural Philosopher" <a@b.c> wrote in message
news:1228130633.20834.0@proxy01.news.clara.net...
> SAM wrote:
>> Le 11/30/08 1:05 AM, The Natural Philosopher a �crit :
>>> SAM wrote:
>>>> Le 11/29/08 12:41 PM, The Natural Philosopher a �crit :
>>>>> I raised this last week, and found a reasonable hack, but would like
>>>>> to get a better solution, and hopefully a more elegant solution..that
>>>>> runs a heck of a lot faster.
>>>>>
>>>>> basically its a flyout menu system,
>>
>> with 2000 items ... it's not more a menu !
>> That's a dictionary !
>>
> Actually its a complete stock list from a small manufacturing company.
>
>
> There are about 1000 items in it in about 50 categories organised as a
> hierarchy. I need to be able to rapidly navigate this in order to create
> assemblies of parts, and also to populate sales and purchase orders.
FFS do this server side.
|
|
0
|
|
|
|
Reply
|
rf
|
12/1/2008 12:13:16 PM
|
|
SAM wrote:
> Le 12/1/08 12:37 AM, David Mark a �crit :
>> On Nov 30, 6:00 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
>> wrote:
>>> Le 11/30/08 10:59 PM, David Mark a �crit :
>>>
>>>> Again with the French.
>>> Lovely !
>>> And you got the simultaneous translation, happy guy.
>>
>> And how would I know it is a translation?
>
> Google ? Yahoo! ? <http://www.lexilogos.com/english/translation.htm> ?
> for example.
>
>>> But that was not my interest at this time.
>>
>> Whether it is your interest or not is irrelevant. You posted a very
>> faulty example.
>
> So sorry.
>
>>> I do not understand very well why you didn't give the solution when the
>>> philosopher was running in circle around his divs to show and hide ?
>>
>> The "philosopher" is constantly going around in circles as he refuses
>> to learn anything.
>
> Do you think ? He says he's a good programmer, no ?
I refuse to learn more than I need to to get the immediate job in hand done.
I learnt that running businesses. There isn't enough time in the day to
get to the intense detail of everything, and a road that goes in the
right direction, even if it not the BEST road, may be a faster road than
spending longer than the journey time, deciding which one IS. ;-)
I asked some very simple questions, about how to identify DOM elements
rapidly, or preload their values into javascript.
Jorge was helpful enough to actually answer those by saying 'it cant be
done' which meant that my hack was as good as anything else, unless I
totally changed the approach.
Now I agree in an ideal world, going 'all script' is arguably better.
But I haven't TIME to get to that. it would take me longer to recode to
do that, for no actual performance gains.
So, apologies to those whose suggestions I DIDN'T follow up, and no
disrespect. I have a lot to do here.
Anywy te customer likes it. So thats good enough for now.
>
|
|
0
|
|
|
|
Reply
|
The
|
12/1/2008 12:24:24 PM
|
|
rf wrote:
> "The Natural Philosopher" <a@b.c> wrote in message
> news:1228130633.20834.0@proxy01.news.clara.net...
>> SAM wrote:
>>> Le 11/30/08 1:05 AM, The Natural Philosopher a �crit :
>>>> SAM wrote:
>>>>> Le 11/29/08 12:41 PM, The Natural Philosopher a �crit :
>>>>>> I raised this last week, and found a reasonable hack, but would like
>>>>>> to get a better solution, and hopefully a more elegant solution..that
>>>>>> runs a heck of a lot faster.
>>>>>>
>>>>>> basically its a flyout menu system,
>>> with 2000 items ... it's not more a menu !
>>> That's a dictionary !
>>>
>> Actually its a complete stock list from a small manufacturing company.
>>
>>
>> There are about 1000 items in it in about 50 categories organised as a
>> hierarchy. I need to be able to rapidly navigate this in order to create
>> assemblies of parts, and also to populate sales and purchase orders.
>
> FFS do this server side.
>
>
Speed.
Slow links.
There are reasons why its done the way it is.
Anyway its OK now, with the help from here.
Apart from having made infinite recursion possible server side..sigh.
Another routine to rite, so that children can't father their parents.. ;-)
|
|
0
|
|
|
|
Reply
|
The
|
12/1/2008 12:28:19 PM
|
|
"The Natural Philosopher" <a@b.c> wrote in message
news:1228134498.11422.1@proxy02.news.clara.net...
> rf wrote:
>> "The Natural Philosopher" <a@b.c> wrote in message
>>> There are about 1000 items in it in about 50 categories organised as a
>>> hierarchy. I need to be able to rapidly navigate this in order to create
>>> assemblies of parts, and also to populate sales and purchase orders.
>>
>> FFS do this server side.
> Speed.
>
> Slow links.
>
> There are reasons why its done the way it is.
>
> Anyway its OK now, with the help from here.
So where is this site?
|
|
0
|
|
|
|
Reply
|
rf
|
12/1/2008 12:39:53 PM
|
|
rf wrote:
> "The Natural Philosopher" <a@b.c> wrote in message
> news:1228134498.11422.1@proxy02.news.clara.net...
>> rf wrote:
>>> "The Natural Philosopher" <a@b.c> wrote in message
>
>>>> There are about 1000 items in it in about 50 categories organised as a
>>>> hierarchy. I need to be able to rapidly navigate this in order to create
>>>> assemblies of parts, and also to populate sales and purchase orders.
>>> FFS do this server side.
>> Speed.
>>
>> Slow links.
>>
>> There are reasons why its done the way it is.
>>
>> Anyway its OK now, with the help from here.
>
> So where is this site?
>
>
behind a firewall. Its not a site. Its a database application.
If you are curious, you can see the front face of it, which is not the
code we have bee discussing, here
www.blackandwhite-models.com/Replikit.
That is a test *site* that is publicly visible.
What I am working on is the admin area behind it.
Today.
|
|
0
|
|
|
|
Reply
|
The
|
12/1/2008 12:55:02 PM
|
|
"The Natural Philosopher" <a@b.c> wrote in message
news:1228136266.29265.1@proxy01.news.clara.net...
> rf wrote:
>> So where is this site?
>>
>>
> behind a firewall. Its not a site. Its a database application.
>
> If you are curious, you can see the front face of it, which is not the
> code we have bee discussing, here
>
> www.blackandwhite-models.com/Replikit.
>
> That is a test *site* that is publicly visible.
>
> What I am working on is the admin area behind it.
> Today.
I see no 1000 items.
I see a site that uses <spit>frames</spit> and not a very good one at that.
|
|
0
|
|
|
|
Reply
|
rf
|
12/1/2008 1:02:52 PM
|
|
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 html
>> leave the JS to complete from Json array each flyout on demand
>>
> Yeah. 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.
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
|
|
0
|
|
|
|
Reply
|
SAM
|
12/1/2008 1:59:51 PM
|
|
Le 12/1/08 1:24 PM, The Natural Philosopher a �crit :
> SAM wrote:
>> Le 12/1/08 12:37 AM, David Mark a �crit :
>>> On Nov 30, 6:00 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
>>> wrote:
>>>> Le 11/30/08 10:59 PM, David Mark a �crit :
>>>>
>>> The "philosopher" is constantly going around in circles as he refuses
>>> to learn anything.
>>
>> Do you think ? He says he's a good programmer, no ?
>
> I refuse to learn more than I need to to get the immediate job in hand
> done.
Without knowing exactly what you have to display,
I think that some guys here are capable to estimate the best way to do
what you expect and to estimate the time to spend to create this
application than you seem to be able to.
Probably with a correct approach, a correct plan, and beginning back
from scratch it wouldn't need more time than to continue to tinker what
you got.
> even if it not the BEST road, may be a faster road than
> spending longer than the journey time, deciding which one IS. ;-)
That is all decided : json approach !
(but I think now you follow this way, or something close)
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
12/1/2008 2:16:33 PM
|
|
Conrad Lender wrote:
> [...]
> If you're talking about HTTP compression, I highly doubt that. A
> document with ~2000 (normal sized) lines will be decompressed in memory
> in a matter of microseconds or less. Better look for the source of your
> lag elsewhere.
>
> If you're curious about how ZIP works, the algorithm is described here:
> http://en.wikipedia.org/wiki/DEFLATE
gzip (used for compression of HTTP message bodies) != ZIP (used primarily
for compression of files), although both are based on DEFLATE.
<http://en.wikipedia.org/wiki/ZIP>
<http://en.wikipedia.org/wiki/gzip>
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>
|
|
0
|
|
|
|
Reply
|
Thomas
|
12/1/2008 4:01:50 PM
|
|
On Dec 1, 8:59=A0am, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
> Le 12/1/08 12:21 PM, The Natural Philosopher a =E9crit :
>
> > 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 wha=
t
> > 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang=3D"fr">
But it isn't, it is in English.
<head>
<meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf-8">
<meta name=3D"License" content=3D"http://creativecommons.org/licenses/by-
nc-sa/3.0/deed.fr">
No need to worry about that yet.
<title>Untitled</title>
<style type=3D"text/css">
form { display: block; margin-left: 280px; right: 200px; }
..bonbon { float: left; margin: 9px; padding: 8px; text-align: center;
cursor: pointer;
border: 1px solid red; background: gold; width: 25% }
div dl { display: none; border: 1px solid; background: #ffc;
text-align: center }
Some agents will never be able to show those with script. Never
assign display:none like that (at least not on the Web.)
#viewer { position: fixed; _position: absolute; top:50px;
width: 250px; left:30px; display: none }
_position?
#viewer dl { display: block; }
#viewer dt, #viewer dl { margin:0; padding: 6px }
#viewer img { width: 80%; }
#viewer span { display: block; margin: 8px; color:red; background:
white; padding: 4px 9px; border: 1px solid; }
input.qq { width: 2em }
</style>
<script type=3D"text/javascript">
/****************** with Laurent's code : ***********************/
function getTarget(e)
{
var target;
e =3D e || window.event;
// e.srcElement, is for IE
target =3D e.target || e.srcElement;
// old safari bug
Neither a bug, nor specific to Safari (of any age.)
if ( target.nodeType =3D=3D=3D 3 ) { target =3D target.parentNode; }
return target;
}
function listener(e)
{
var target =3D getTarget(e);
// we got a target and we don't know what it is !
// not the more efficient way to detect, blah blah, yeah I know
if ( target && target.tagName)
Well, we know we got an element. We want to know if the tagName
property is a string.
{
var t =3D target.tagName.toUpperCase();
if(t =3D=3D 'DIV'|| t =3D=3D 'H3')
{
while(target.tagName.toUpperCase() !=3D 'DIV') target =3D
target.parentNode;
Yikes. Tighten up that loop condition.
fly(target);
return false;
}
}
return true;
}
window.onload =3D function()
{
var ul =3D document.body; // getElementsByTagName('div')[0];
ul.onmouseover =3D listener;
Better. Odd name for the variable though. And is there not a list
somewhere to use instead of the body?
/************* end Laurent's code *******************/
function fly(that) {
// not the more efficient way to detect, blah blah, yeah I know
var f =3D that.getElementsByTagName('dl')[0].cloneNode(true);
f.style.display =3D 'block';
var v =3D document.getElementById('viewer'); // yes it's there. I know,
that's me who wrote it !
You still test the result. You can't know for sure that you have a
reference to it without testing. What if some stupid advertising
script clobbered it?
if(v.getElementsByTagName('dl').length>0) {
Remove the ">0".
v.removeChild( v.getElementsByTagName('dl')[0] );
}
v.appendChild(f);
if(document.all) {
v.style.top =3D -50+that.offsetTop+'px';
}
Are you a programmer or a comedian?
[snip]
|
|
0
|
|
|
|
Reply
|
David
|
12/1/2008 6:05:39 PM
|
|
rf wrote:
> "The Natural Philosopher" <a@b.c> wrote in message
> news:1228136266.29265.1@proxy01.news.clara.net...
>> rf wrote:
>
>>> So where is this site?
>>>
>>>
>> behind a firewall. Its not a site. Its a database application.
>>
>> If you are curious, you can see the front face of it, which is not the
>> code we have bee discussing, here
>>
>> www.blackandwhite-models.com/Replikit.
>>
>> That is a test *site* that is publicly visible.
>>
>> What I am working on is the admin area behind it.
>> Today.
>
> I see no 1000 items.
>
> I see a site that uses <spit>frames</spit> and not a very good one at that.
>
Well fuck you too!
I said what lies behind it is 1000 items.
There are only about 300 assemblies/parst for SALE.. I don't mark ever
nut bolt screw and cut piece of wood as visible for sale in the shop.
The shop uses almost no javascript either, as many browsers may not
handle it well.
Its the back office stuff thats being worked on - the shop is just a
showpiece for comment.
>
|
|
0
|
|
|
|
Reply
|
The
|
12/1/2008 6:23:14 PM
|
|
SAM wrote:
> Le 12/1/08 1:24 PM, The Natural Philosopher a �crit :
>> SAM wrote:
>>> Le 12/1/08 12:37 AM, David Mark a �crit :
>>>> On Nov 30, 6:00 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
>>>> wrote:
>>>>> Le 11/30/08 10:59 PM, David Mark a �crit :
>>>>>
>>>> The "philosopher" is constantly going around in circles as he refuses
>>>> to learn anything.
>>>
>>> Do you think ? He says he's a good programmer, no ?
>>
>> I refuse to learn more than I need to to get the immediate job in hand
>> done.
>
> Without knowing exactly what you have to display,
> I think that some guys here are capable to estimate the best way to do
> what you expect and to estimate the time to spend to create this
> application than you seem to be able to.
>
> Probably with a correct approach, a correct plan, and beginning back
> from scratch it wouldn't need more time than to continue to tinker what
> you got.
>
>
>> even if it not the BEST road, may be a faster road than spending
>> longer than the journey time, deciding which one IS. ;-)
>
> That is all decided : json approach !
> (but I think now you follow this way, or something close)
>
Nope. I am going my own way.
In essence, as little javascript for teh site facing the world, and only
as much as is absolutely necessary to get what I want, tuned to go as
fast as I can get it.
I am sure your stuff is great, but I don't have the time to look at it.
Been chasing SQL speed issues today instead.
|
|
0
|
|
|
|
Reply
|
The
|
12/1/2008 6:26:13 PM
|
|
On Dec 1, 1:23=A0pm, The Natural Philosopher <a...@b.c> wrote:
> rf wrote:
> > "The Natural Philosopher" <a...@b.c> wrote in message
> >news:1228136266.29265.1@proxy01.news.clara.net...
> >> rf wrote:
>
> >>> So where is this site?
>
> >> behind a firewall. Its not a site. Its a database application.
>
> >> If you are curious, you can see the front face of it, which is not the
> >> code we have bee discussing, here
>
> >>www.blackandwhite-models.com/Replikit.
Yikes.
>
> >> That is a test *site* that is publicly visible.
>
> >> What I am working on is the admin area behind it.
> >> Today.
>
> > I see no 1000 items.
>
> > I see a site that uses <spit>frames</spit> and not a very good one at t=
hat.
>
> Well fuck you too!
>
> I said what lies behind it is 1000 items.
I can guess what lies behind it.
>
> There are only about 300 assemblies/parst for SALE.. I don't mark ever
> nut bolt screw and cut piece of wood as visible for sale in the shop.
You won't have to worry about sales.
>
> The shop uses almost no javascript either, as many browsers may not
> handle it well.
Seems sensible to use as little of your scripts as possible.
>
> Its the back office stuff thats being worked on - the shop is just a
> showpiece for comment.
Your site is abominable, even by your wretched standards.
[snip]
|
|
0
|
|
|
|
Reply
|
David
|
12/1/2008 6:36:46 PM
|
|
Le 12/1/08 7:05 PM, David Mark a �crit :
> On Dec 1, 8:59 am, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
> wrote:
>> Le 12/1/08 12:21 PM, The Natural Philosopher a �crit :
>>
>> 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
>
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">
> <html lang="fr">
>
> But it isn't, it is in English.
Ha? Did I write in English by inadvertence ?
Sorry, next time I'll write in French.
> <head>
> <meta http-equiv="content-type" content="text/html; charset=utf-8">
> <meta name="License" content="http://creativecommons.org/licenses/by-
> nc-sa/3.0/deed.fr">
>
> No need to worry about that yet.
Nope indeed.
(as previous and some next, all that are in a template that I reuse)
> <title>Untitled</title>
> <style type="text/css">
> form { display: block; margin-left: 280px; right: 200px; }
> .bonbon { float: left; margin: 9px; padding: 8px; text-align: center;
> cursor: pointer;
> border: 1px solid red; background: gold; width: 25% }
> div dl { display: none; border: 1px solid; background: #ffc;
> text-align: center }
>
> Some agents will never be able to show those with script. Never
> assign display:none like that (at least not on the Web.)
>
> #viewer { position: fixed; _position: absolute; top:50px;
> width: 250px; left:30px; display: none }
>
> _position?
Hack for the BS IE. (doesn't know what is 'fixed', no?)
> #viewer dl { display: block; }
> #viewer dt, #viewer dl { margin:0; padding: 6px }
> #viewer img { width: 80%; }
> #viewer span { display: block; margin: 8px; color:red; background:
> white; padding: 4px 9px; border: 1px solid; }
> input.qq { width: 2em }
> </style>
> <script type="text/javascript">
>
> /****************** with Laurent's code : ***********************/
> function getTarget(e)
> {
> var target;
> e = e || window.event;
> // e.srcElement, is for IE
> target = e.target || e.srcElement;
> // old safari bug
>
> Neither a bug, nor specific to Safari (of any age.)
OOOooooppppssss ! forgotten the David Mark's annotation. :-)
> if ( target.nodeType === 3 ) { target = target.parentNode; }
> return target;
> }
>
> function listener(e)
> {
> var target = getTarget(e);
> // we got a target and we don't know what it is !
> // not the more efficient way to detect, blah blah, yeah I know
> if ( target && target.tagName)
>
> Well, we know we got an element. We want to know if the tagName
> property is a string.
Do you translate what is coded, or did I make an error ?
Doesn't it enough to know there is a tag regardless of whether it's a
string or a Martian ?
> {
> var t = target.tagName.toUpperCase();
> if(t == 'DIV'|| t == 'H3')
> {
> while(target.tagName.toUpperCase() != 'DIV') target =
> target.parentNode;
>
> Yikes. Tighten up that loop condition.
Certainly you want to help me to progress in English,
'Yikes' isn't in my dictionary.
The rest has not more sens for me.
Why and how to strengthen this condition?
> fly(target);
> return false;
> }
> }
> return true;
> }
>
> window.onload = function()
> {
> var ul = document.body; // getElementsByTagName('div')[0];
> ul.onmouseover = listener;
>
> Better. Odd name for the variable though.
As I said : +/- finished
and large parts of code are copied-pasted from the NG
and its author specified.
I do not more know if window has to be called or not with all what you
told around Jim Ley's posts.
> And is there not a list somewhere to use instead of the body?
I used lists in other tests, and could destabilize someone ;-)
One step after one.
I try to show something to somebody.
If he is interested and begin to understand ... perhaps some more ?
.... when I'll have learned more about listeners.
> /************* end Laurent's code *******************/
>
> function fly(that) {
> // not the more efficient way to detect, blah blah, yeah I know
> var f = that.getElementsByTagName('dl')[0].cloneNode(true);
> f.style.display = 'block';
> var v = document.getElementById('viewer'); // yes it's there. I know,
> that's me who wrote it !
>
> You still test the result. You can't know for sure that you have a
> reference to it without testing.
As I wrote, the code was wrote by myself with my own finger so
I know the div exists.
(Yes I tape with only 1 finger ! + my thumb)
> What if some stupid advertising script clobbered it?
Who accept advertisement in his pages ?
That could exist ?
> if(v.getElementsByTagName('dl').length>0) {
>
> Remove the ">0".
Not bad.
> v.removeChild( v.getElementsByTagName('dl')[0] );
> }
> v.appendChild(f);
> if(document.all) {
> v.style.top = -50+that.offsetTop+'px';
> }
>
> Are you a programmer or a comedian?
Certainly not a programmer, I do not even know what that can be.
If you have a very short code to tell IE where to place the div you're
welcome.
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
12/1/2008 9:45:01 PM
|
|
Le 12/1/08 7:26 PM, The Natural Philosopher a �crit :
> SAM wrote:
>>
>> That is all decided : json approach !
>> (but I think now you follow this way, or something close)
>>
> Nope. I am going my own way.
> In essence, as little javascript for teh site facing the world, and only
> as much as is absolutely necessary to get what I want, tuned to go as
> fast as I can get it.
I will not come back on that.
> I am sure your stuff is great, but I don't have the time to look at it.
>
> Been chasing SQL speed issues today instead.
:-( I understood all that was made !
Json ? no ? sure ?
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
12/1/2008 9:49:44 PM
|
|
Le 12/1/08 7:36 PM, David Mark a �crit :
> On Dec 1, 1:23 pm, The Natural Philosopher <a...@b.c> wrote:
>> rf wrote:
>>>> code we have bee discussing, here
>>>> www.blackandwhite-models.com/Replikit.
>
> Yikes.
Tremendous !
But what does it want to say?
I do not see even how's that can pronounce!
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
12/1/2008 9:55:01 PM
|
|
"The Natural Philosopher" <a@b.c> wrote in message
news:1228155795.24683.1@proxy00.news.clara.net...
> rf wrote:
>> "The Natural Philosopher" <a@b.c> wrote in message
>> news:1228136266.29265.1@proxy01.news.clara.net...
>>> rf wrote:
>>
>>>> So where is this site?
>>> www.blackandwhite-models.com/Replikit.
>>>
>>> That is a test *site* that is publicly visible.
>> I see a site that uses <spit>frames</spit> and not a very good one at
>> that.
> Well fuck you too!
No, not me, your site.
http://barefile.com.au/test/replikit.jpg
See any scroll bars so I can scroll right to look at your telephone number?
I don't.
What point is there in having content on the page, and important content at
that, that is unviewable?
|
|
0
|
|
|
|
Reply
|
rf
|
12/1/2008 10:37:50 PM
|
|
rf wrote:
> "The Natural Philosopher" <a@b.c> wrote in message
> news:1228155795.24683.1@proxy00.news.clara.net...
>> rf wrote:
>>> "The Natural Philosopher" <a@b.c> wrote in message
>>> news:1228136266.29265.1@proxy01.news.clara.net...
>>>> rf wrote:
>>>>> So where is this site?
>
>>>> www.blackandwhite-models.com/Replikit.
>>>>
>>>> That is a test *site* that is publicly visible.
>
>>> I see a site that uses <spit>frames</spit> and not a very good one at
>>> that.
>> Well fuck you too!
>
> No, not me, your site.
> http://barefile.com.au/test/replikit.jpg
>
> See any scroll bars so I can scroll right to look at your telephone number?
> I don't.
>
> What point is there in having content on the page, and important content at
> that, that is unviewable?
>
>
>
its always in view.
Except for IPODs. And junk like that. People who buy small computers we
don't want to see anyway. ;-)
|
|
0
|
|
|
|
Reply
|
The
|
12/1/2008 11:30:47 PM
|
|
On Dec 1, 6:30=A0pm, The Natural Philosopher <a...@b.c> wrote:
> rf wrote:
> > "The Natural Philosopher" <a...@b.c> wrote in message
> >news:1228155795.24683.1@proxy00.news.clara.net...
> >> rf wrote:
> >>> "The Natural Philosopher" <a...@b.c> wrote in message
> >>>news:1228136266.29265.1@proxy01.news.clara.net...
> >>>> rf wrote:
> >>>>> So where is this site?
>
> >>>>www.blackandwhite-models.com/Replikit.
>
> >>>> That is a test *site* that is publicly visible.
>
> >>> I see a site that uses <spit>frames</spit> and not a very good one at
> >>> that.
> >> Well fuck you too!
>
> > No, not me, your site.
> >http://barefile.com.au/test/replikit.jpg
>
> > See any scroll bars so I can scroll right to look at your telephone num=
ber?
> > I don't.
>
> > What point is there in having content on the page, and important conten=
t at
> > that, that is unviewable?
>
> its always in view.
You are a complete and utter prat.
>
> Except for IPODs. And junk like that. People who buy small computers we
> don't want to see anyway. ;-)
I can't see the phone number either and I am using IE7 on a 60"
monitor. See above.
|
|
0
|
|
|
|
Reply
|
David
|
12/1/2008 11:56:23 PM
|
|
Le 12/2/08 12:56 AM, David Mark a �crit :
> On Dec 1, 6:30 pm, The Natural Philosopher <a...@b.c> wrote:
>> rf wrote:
>>> "The Natural Philosopher" <a...@b.c> wrote in message
>>> news:1228155795.24683.1@proxy00.news.clara.net...
>>>> rf wrote:
>>>>> "The Natural Philosopher" <a...@b.c> wrote in message
>>>>> news:1228136266.29265.1@proxy01.news.clara.net...
>>>>>> rf wrote:
>>>>>>> So where is this site?
>>>>>> www.blackandwhite-models.com/Replikit.
>>>>>> That is a test *site* that is publicly visible.
Next time you'll give the correct url :
<http://www.blackandwhite-models.com/shop_by_category.php>
>>>>> I see a site that uses <spit>frames</spit> and not a very good one at
>>>>> that.
>>>> Well fuck you too!
>>> No, not me, your site.
>>> http://barefile.com.au/test/replikit.jpg
>>> See any scroll bars so I can scroll right to look at your telephone number?
>>> I don't.
>>> What point is there in having content on the page, and important content at
>>> that, that is unviewable?
>> its always in view.
>
> You are a complete and utter prat.
"prat" is not in my dictionnaries.
>> Except for IPODs. And junk like that. People who buy small computers we
>> don't want to see anyway. ;-)
>
> I can't see the phone number either and I am using IE7 on a 60"
> monitor. See above.
In your file : /Replikit/Top.html
change :
<table width="1125px" (which is not correct anyway)
by :
<table width="100%" (to get the table adapted to viewport width)
As you seem to want to alight you files, you could begin with your CSS,
then continue with your HTML.
ie, in your page : shop_by_category.php?category_id=67
you don't need to do :
<Table width="100%" border="0" cellpadding="1" cellspacing="3">
<TR>
<td class="menublock"><b>Part #:</b></td>
<td class="menublock"><b>Picture:</b></td>
<TD class="menublock" ><b>Item</b></td>
<TD class = "menublock"><b>Stock</b></TD>
<TD class="menublock"><b> Price</b></td>
</tr>
it would be enough to do (and suppressing the inutile bold tags):
<Table class="menublock"
width="100%" border="0" cellpadding="1" cellspacing="3">
<TR>
<th>Part #:</th>
<th>Picture:</th>
<Th>Item</th>
<Th>Stock</Th>
<Th>Price</th>
</tr>
In following rows of this table, I do not understand why you need :
- span (if it is for the class, the TD can receive it)
- onmouseBlah whom alone object is to style the link
Anyway no classes s1, s2, s3 are needed at all.
At least : you'll gain 10 to 20% weight.
(and without TABLE probably 10% more)
I pass on the 26 errors of html that Tidy shown me.
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
12/2/2008 9:02:03 AM
|
|
On Dec 2, 4:02=A0am, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
> Le 12/2/08 12:56 AM, David Mark a =E9crit :
>
> > On Dec 1, 6:30 pm, The Natural Philosopher <a...@b.c> wrote:
> >> rf wrote:
> >>> "The Natural Philosopher" <a...@b.c> wrote in message
> >>>news:1228155795.24683.1@proxy00.news.clara.net...
> >>>> rf wrote:
> >>>>> "The Natural Philosopher" <a...@b.c> wrote in message
> >>>>>news:1228136266.29265.1@proxy01.news.clara.net...
> >>>>>> rf wrote:
> >>>>>>> So where is this site?
> >>>>>>www.blackandwhite-models.com/Replikit.
> >>>>>> That is a test *site* that is publicly visible.
>
> Next time you'll give the correct url :
> <http://www.blackandwhite-models.com/shop_by_category.php>
>
> >>>>> I see a site that uses <spit>frames</spit> and not a very good one =
at
> >>>>> that.
> >>>> Well fuck you too!
> >>> No, not me, your site.
> >>>http://barefile.com.au/test/replikit.jpg
> >>> See any scroll bars so I can scroll right to look at your telephone n=
umber?
> >>> I don't.
> >>> What point is there in having content on the page, and important cont=
ent at
> >>> that, that is unviewable?
> >> its always in view.
>
> > You are a complete and utter prat.
>
> "prat" is not in my dictionnaries.
http://www.merriam-webster.com/dictionary/prat
>
> >> Except for IPODs. And junk like that. People who buy small computers w=
e
> >> don't want to see anyway. ;-)
>
> > I can't see the phone number either and I am using IE7 on a 60"
> > monitor. =A0See above.
>
> In your file : /Replikit/Top.html
Not my file. Perhaps this reply was meant for the "philospher?"
[snip]
|
|
0
|
|
|
|
Reply
|
David
|
12/2/2008 9:12:25 AM
|
|
Le 12/2/08 10:12 AM, David Mark a �crit :
> On Dec 2, 4:02 am, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
> wrote:
>> Le 12/2/08 12:56 AM, David Mark a �crit :
>>
>>> You are a complete and utter prat.
>> "prat" is not in my dictionnaries.
>
> http://www.merriam-webster.com/dictionary/prat
Thanks.
Very useful (with pronunciation too) and speedy (hop! bookmarked).
Now I know (for the moment) what 'Yikes' could be.
>> In your file : /Replikit/Top.html
>
> Not my file. Perhaps this reply was meant for the "philospher?"
Little error in quoting ?
Hope The Phil' will follow.
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
12/2/2008 10:04:56 AM
|
|
In comp.lang.javascript message <49350848$0$895$ba4acef3@news.orange.fr>
, Tue, 2 Dec 2008 11:04:56, SAM <stephanemoriaux.NoAdmin@wanadoo.fr.inva
lid> posted:
>> http://www.merriam-webster.com/dictionary/prat
>
>Thanks.
>Very useful (with pronunciation too) and speedy (hop! bookmarked).
>Now I know (for the moment) what 'Yikes' could be.
Remember that that is not a dictionary of the English language; for
that, you should go to Scotland, and consult <http://www.chambersharrap.
co.uk/chambers/index.shtml>, if you cannot access the OED itself.
--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 7.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
I find MiniTrue useful for viewing/searching/altering files, at a DOS prompt;
free, DOS/Win/UNIX, <URL:http://www.idiotsdelight.net/minitrue/> unsupported.
|
|
0
|
|
|
|
Reply
|
Dr
|
12/2/2008 7:41:38 PM
|
|
Le 12/2/08 8:41 PM, Dr J R Stockton a �crit :
> In comp.lang.javascript message <49350848$0$895$ba4acef3@news.orange.fr>
> , Tue, 2 Dec 2008 11:04:56, SAM <stephanemoriaux.NoAdmin@wanadoo.fr.inva
> lid> posted:
>>> http://www.merriam-webster.com/dictionary/prat
>> Thanks.
>> Very useful (with pronunciation too) and speedy (hop! bookmarked).
>> Now I know (for the moment) what 'Yikes' could be.
>
> Remember that that is not a dictionary of the English language; for
> that, you should go to Scotland, and consult <http://www.chambersharrap.
> co.uk/chambers/index.shtml>, if you cannot access the OED itself.
Thanks, very fast too.
Unlovely without pronunciation.
and ... it doesn't know 'Yikes'
while it knows 'yoicks' (for sure ! in GB)
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
12/2/2008 8:55:25 PM
|
|
SAM wrote:
> Le 12/1/08 7:36 PM, David Mark a �crit :
>>
>> Yikes.
>
> Tremendous !
> But what does it want to say?
It's an interjection expressing shock or horror, of uncertain
provenance. (Merriam-Webster says "probably an alteration of
'yoicks'", which was an 18th-century cry to encourage foxhounds, but
this does not particularly clarify the matter.)
> I do not see even how's that can pronounce!
In SAMPA, I believe it'd be /jaIks/. Like "bikes" but with a different
initial consonant. (As is usually the case in English, the final "e"
is silent and makes the preceding "i" pronounced as the so-called
"long I", which is actually the diphthong /aI/ in English Received
Pronunciation and General American English. Australians typically
pronounce long-I, with I think a back-vowel offglide rather than a
front-vowel one - probably because of being upside-down all the time -
but I'm no linguist.)
--
Michael Wojcik
Micro Focus
Rhetoric & Writing, Michigan State University
|
|
0
|
|
|
|
Reply
|
Michael
|
12/4/2008 6:16:20 PM
|
|
Michael Wojcik wrote:
> [...] Australians typically pronounce long-I, with I think a back-vowel
> offglide rather than a front-vowel one - probably because of being
^^^^^^^^^^^^^^^^^^^^^^^^^
> upside-down all the time - but I'm no linguist.)
^^^^^^^^^^^^^^^^^^^^^^^^
YMMD.
\\// PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
|
|
0
|
|
|
|
Reply
|
Thomas
|
12/4/2008 9:11:11 PM
|
|
Le 12/4/08 7:16 PM, Michael Wojcik a �crit :
> SAM wrote:
>
>> I do not see even how that can pronounce!
>
> Australians typically pronounce long-I, with I think a back-vowel
> offglide rather than a front-vowel one
We learn much about everything in this group !
> - probably because of being upside-down all the time -
:-)
--
sm
|
|
0
|
|
|
|
Reply
|
SAM
|
12/4/2008 11:47:15 PM
|
|
|
93 Replies
477 Views
(page loaded in 0.551 seconds)
Similiar Articles: wait for one IFRAME to load before loading a second IFRAME - comp ...speed issues traversing the DOM. - comp.lang.javascript wait for one IFRAME to load before loading a second IFRAME - comp ... speed issues traversing the DOM. - comp.lang ... innerHTML vs value for TEXTAREA element - comp.lang.javascript ...speed issues traversing the DOM. - comp.lang.javascript > > >>> It needs gEBTN, appendChild, cloneNode and the non-standard innerHTML ... innerHTML vs value for TEXTAREA ... Changing annotation screen font - comp.text.pdfspeed issues traversing the DOM. - comp.lang.javascript... is php created, so its no big deal to utterly change ... display='block'; // this is a catchall 'glass' screen ... ServerSocket.accept() stops GUI loading - comp.lang.java.gui ...speed issues traversing the DOM. - comp.lang.javascript That would kill the page load time. By traversing all ... As some browsers accept document.all when in same time ... Determining whether a polygon face is front-facing or back-facing ...speed issues traversing the DOM. - comp.lang.javascript Whether it is your interest or not is ... If you are curious, you can see the front face ... pronounce long-I, with ... having trouble with event listener: detect iframe close event from ...speed issues traversing the DOM. - comp.lang.javascript Isn't it enough to close the ... onclick = listener; }; Event delegation is the action of setting the listener on a ... onclick get another cells innerText - comp.lang.javascript ...speed issues traversing the DOM. - comp.lang.javascript... test will be deleted (does M$ expects to offer a new ... is assigned in the .html in this way: <div onclick=3D ... Creating a markup layer - comp.graphics.api.openglspeed issues traversing the DOM. - comp.lang.javascript But it would be nice to know a better way of creating a ... side, by sending the *data* from the server, not markup ... hygecdf returns different results in Matlab 2007 vs later versions ...speed issues traversing the DOM. - comp.lang.javascript... that will need undisplaying later ... page/Main_Page> but the version for Mac dates of 2007 > AsI ... elisp: make text as clickable url - comp.emacsspeed issues traversing the DOM. - comp.lang.javascript <div> <h2>title</h2> <p>Normal viewed text</p ... event that spawns yet another leaf, or a clickable entity ... x11, wxt, special characters, fonts etc - comp.graphics.apps ...speed issues traversing the DOM. - comp.lang.javascript Try to use what HTML gives as special tags and loop only ... ll find a task manager for IE.linux runing under X11 ... Visual comparisons of screens for GUI non-regression - comp.lang ...speed issues traversing the DOM. - comp.lang.javascript... has the horsepower anyway) and reducing visual lag ... 3D 3 ) { target =3D You don't need a strict comparison ... Sync scrolling of divs (not frames) - comp.lang.javascript ...speed issues traversing the DOM. - comp.lang.javascript basically its a flyout menu system, of this sort of form <Div frame> <div an ... Which connexion and UC will be ... Set a selection of a uibutton group element (Changing users choice ...speed issues traversing the DOM. - comp.lang.javascript... so its no big deal to utterly change the 2000 odd elements with ... you at page creation time build a set ... C++ Customize Context Menus - comp.os.ms-windows.programmer.win32 ...speed issues traversing the DOM. - comp.lang.javascript It seems that in the javascript DOM context all you can do ... So a menu clear was > needlessly clearing three ... Traversing the DOM | JavaScript TutorialIn the world of DOM, an “element not found” or ... Traversing the DOM; Basic DOM Node properties; Attributes and custom ... Infinite backtracking problem; Groups; Alternation ; Regular ... Best DOM tree traverse [Archive] - Dynamic Drive ForumsThe problem is that it is taking too much time to traverse/change the DOM tree. ... obviously no way to speed up ... Conclusion: traversing the DOM tree on the ... 7/23/2012 11:15:08 AM
|