FAQ Topic - How do I modify the content of the current page? (2010-04-14)

D

David Mark

Stefan said:
If that's what you meant, then I misunderstood you, too. "Exiting an
execution context" is ambiguous - I also thought you meant "returning
from an execution context", either explicitly or when there are no more
statements to process, instead of "entering a new execution context".
(OTOH, there may be no practical difference, because both are connected)

To be precise, I mean leaving an execution context on either calling
another function or on finishing execution of the last statement (at
which point it returns to the caller's execution context, assuming the
call stack is not exhausted at that point).
I've noticed unexpected redraws in Opera in the past, when they didn't
happen in other browsers on the same PC. Maybe Opera really does handle
things differently here, or maybe all browsers do this, as you say, but
with a different heuristic/logic behind the decision.

There's no telling exactly when any given browser will do it. But they
won't do it at all unless you exit an execution context. That much I
know. I can't speak for every browser, but I've tested more than my
share over the years.
In any case, this
effect is not easy to prove*, and there are still no official documents
describing when a redraw is likely to happen (before the thread ends).

Correct. You have to draw upon experience. I have also discussed this
with other experienced developers (and some of those discussions are in
the archive).
You said you could easily produce a test case for your PC.

Sure. Set a previously hidden element's visibility style to "visible"
(assuming it does not have a display style of "none" of course). Then
call a function that clips it (or sizes it or whatever). Try it in
various browsers (as mentioned slower or burdened PC's seem to be the
best bet) and watch for a flicker of the full element before the clip
(or size or whatever). Once reproduced, it is trivial to fix by setting
the subsequent style without calling a function.

I most recently ran into this when dealing with IE's filter style.
Displaying the element just prior to calling a function that adjusted
the filter style resulted in a momentary flash of the unfiltered
element. This happened virtually every time (on at least one machine
anyway). Setting the filter style in the same function that displayed
the element (with no function calls in between) fixed it for good. Of
course, this only happened when styling a particular DOM structure. The
same code operating on a different structure (or even the same structure
in a different document) did not. So trying to track such behavior will
drive you nuts. It's best to look at the code, rather than the browser
window (assuming you know what to look for). ;)
It would be
helpful if you could put this test online, so that more people with
different configurations can try it and share their results.

As it happens, the one I describe above is online, but with a workaround
in place. I used a workaround of setting the opacity to 0, then
applying the other filter, calling the function that shows the element
and then setting the opacity back on return from that function (unless
the effect is fade of course, in which case I let it be). Eventually I
will update the library code as I can see where the potential for a
problem lies (and it had lay dormant for years until I started on the
Alert example). As mentioned, this never happened on another page that
shows/hides the same DOM structure with the same code (the Build Test
page has no such workaround). Basically, a fade-in on the latter page
was fine, but on the Examples page (in IE8 only), I got a flicker of the
fully opaque element. But it is no mystery as the animation code
clearly has one place where this can happen.

Hit my Examples page with IE8 and see the note in the alert section.
There's enough explanation there to try to reproduce the issue in a
sandbox. But your sandbox may well have to mimic the Examples page (and
your PC may well have to be similar to my test machine). FWIW, IE8 is a
major dog on that particular machine and the Examples page is fairly
long-winded with tons of form controls.

http://www.cinsoft.net/mylib-examples.html#myalert

Perhaps I will put up a test version without the workaround when I get a
chance, but no promises. I am pretty swamped these days and I am not
particularly curious as I know exactly where the potential for a problem
lies.
*) apart from reading the source, where that is possible. Given time, I
can find my way around the Mozilla and Webkit sources, but these days
it's mostly a maze of macros and arcane optimizations. I don't go there
unless I absolutely have to. My last encounter with Mozilla code left me
scarred and traumatized for life.

Don't bother (not for this anyway). :) As an aside, I've had previous
issues like this with various FF versions (again, usually on slow
machines). The solution was always the same.
I did, but came up empty. I really wish Google would stop treating
Usenet search like an unwanted child.

Yes, GG sucks. I got lucky and found one of the threads I was thinking of:-

http://groups.google.com/group/comp...39923b4b9d/b09cb6f082f1487e?#b09cb6f082f1487e
Their web search is great, almost
psychic at times, but with their Usenet index, I sometimes can't even
find a message when I know the group and the exact subject.

Tell me about it. :(
That thing
is seriously broken. "Searching the archive" is a good idea but not a
guarantee for success.

It's unfortunate. But you can use their Web search as well as these
posts echo all over the place.
I don't doubt it, but that's still anecdotal evidence from one person.
We should be able to do better than that.

Possibly. As mentioned, it's one of those issues that shows up
sporadically. I only know the way to avoid it entirely, not the way to
reproduce it reliably.

BTW, for those wondering, this does not qualify as a "quick answer". My
"insurance business" would go belly up if I had to give this much
detail for quick questions. The quick answer had been previously given
and is certainly enough to avoid the problem (though it does not
represent a proof of anything). Proofs (when possible) and history
lessons are extra. ;)
 
G

Garrett Smith

David said:
[...]
I've noticed unexpected redraws in Opera in the past, when they didn't
happen in other browsers on the same PC. Maybe Opera really does handle
things differently here, or maybe all browsers do this, as you say, but
with a different heuristic/logic behind the decision.

There's no telling exactly when any given browser will do it.

No, they will repaint after alert, setTimeout, setInterval, etc.

But they
won't do it at all unless you exit an execution context.

Except when they do, such as with the example I provided a link to. I
observed the behavior in a much older version of Mozilla on apple mac.

Doesn't really make much sense from an efficiency standpoint for the
browser to repaint twice when it can repaint once so the fix makes
sense. The browser not doing that anymore seems like a fix.
 
D

David Mark

Garrett said:
David said:
Stefan said:
On 11/05/10 03:07, David Mark wrote:
Garrett Smith wrote:
David Mark wrote:
Garrett Smith wrote:
[...]
I've noticed unexpected redraws in Opera in the past, when they didn't
happen in other browsers on the same PC. Maybe Opera really does handle
things differently here, or maybe all browsers do this, as you say, but
with a different heuristic/logic behind the decision.

There's no telling exactly when any given browser will do it.

No, they will repaint after alert, setTimeout, setInterval, etc.

That only covers a small subset of possibilities.
But they

Except when they do, such as with the example I provided a link to. I
observed the behavior in a much older version of Mozilla on apple mac.

Anything is possible. I didn't say that *every* browser ever made
behaved like this (just the hundreds I've dealt with over the years).
Doesn't really make much sense from an efficiency standpoint for the
browser to repaint twice when it can repaint once so the fix makes
sense. The browser not doing that anymore seems like a fix.

Yes. It makes sense to queue changes until an execution context is
exited. Near as I can tell, that is what they do.
 
G

Garrett Smith

David said:
Garrett said:
David said:
Stefan Weiss wrote:
On 11/05/10 03:07, David Mark wrote:
Garrett Smith wrote:
David Mark wrote:
Garrett Smith wrote: [...]

I've noticed unexpected redraws in Opera in the past, when they didn't
happen in other browsers on the same PC. Maybe Opera really does handle
things differently here, or maybe all browsers do this, as you say, but
with a different heuristic/logic behind the decision.
There's no telling exactly when any given browser will do it.
No, they will repaint after alert, setTimeout, setInterval, etc.

That only covers a small subset of possibilities.

Yes, but those are known cases. I know that with those cases, the
browser will repaint.
Anything is possible. I didn't say that *every* browser ever made
behaved like this (just the hundreds I've dealt with over the years).


Yes. It makes sense to queue changes until an execution context is
exited. Near as I can tell, that is what they do.

It makes sense for the browser to not repaint until execution stack is
complete and that is normally what they do. The odd cases are what I am
interested in; where does the browser repaint other that that?

Repainting flickers may be undesirable, but they're at least not failures.

I have seen in many other cases Safari 2 and older mozilla not
repainting and used the old window bounce trick (resizeBy(0, 1);
resizeBy(0, -1), or scroll tricks, which will either fail or annoy the
user. In some older mozillas (c 0.97) setting window.status would force
a repaint. But that hack didn't last. Obviously throwing a random alert
would be annoying to the user.

I in fact have this very problem with the YUI test runner logger for
Safari 2 in a few of my tests. I can see the results by resizing the
window but for some reason the browser does not repaint.

Anyway, it is senseless to design an API based on the possibility that
browser might be more likely repaint if something is split and moved
into a separate function. Unless of course there is a known case and it
is avoidable and the code expresses that well enough.
 
D

David Mark

Garrett said:
David said:
Garrett said:
David Mark wrote:
Stefan Weiss wrote:
On 11/05/10 03:07, David Mark wrote:
Garrett Smith wrote:
David Mark wrote:
Garrett Smith wrote:
[...]

I've noticed unexpected redraws in Opera in the past, when they didn't
happen in other browsers on the same PC. Maybe Opera really does
handle
things differently here, or maybe all browsers do this, as you say,
but
with a different heuristic/logic behind the decision.
There's no telling exactly when any given browser will do it.
No, they will repaint after alert, setTimeout, setInterval, etc.

That only covers a small subset of possibilities.

Yes, but those are known cases. I know that with those cases, the
browser will repaint.
Anything is possible. I didn't say that *every* browser ever made
behaved like this (just the hundreds I've dealt with over the years).


Yes. It makes sense to queue changes until an execution context is
exited. Near as I can tell, that is what they do.

It makes sense for the browser to not repaint until execution stack is
complete and that is normally what they do.

No, that is your bad assumption.
The odd cases are what I am
interested in; where does the browser repaint other that that?

For the fiftieth time, on exiting execution contexts with pending DOM
changes (and when other unknown criteria are met). There's no way to
pin them down exactly on that. Just avoid repaints (as well as reflows)
in contexts where they can be destructive or wasteful.
Repainting flickers may be undesirable, but they're at least not failures.

Depends on your standards. If your goal is to create a "cool" effect,
you can consider a flicker to be a failure (it sure as hell doesn't look
cool). Not to mention that repaints can be _very_ expensive. It's a
matter of performance as well as aesthetics.
I have seen in many other cases Safari 2 and older mozilla not
repainting and used the old window bounce trick (resizeBy(0, 1);
resizeBy(0, -1), or scroll tricks, which will either fail or annoy the
user. In some older mozillas (c 0.97) setting window.status would force
a repaint. But that hack didn't last. Obviously throwing a random alert
would be annoying to the user.

There are some odd cases where older browsers fail to repaint when they
should. I haven't had to deal with that in some time.
I in fact have this very problem with the YUI test runner logger for
Safari 2 in a few of my tests. I can see the results by resizing the
window but for some reason the browser does not repaint.

It's a badly broken browser.
Anyway, it is senseless to design an API based on the possibility that
browser might be more likely repaint if something is split and moved
into a separate function. Unless of course there is a known case and it
is avoidable and the code expresses that well enough.

ISTM from your queries that you simply lack experience in this area.
And it isn't always the case that you have to deal with the issue
anyway. Context, context, context. ;) Hell, even in a comprehensive
GP script like My Library, there is virtually nothing I would do
differently, even if the issue did not exist.
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]
september.org>, Sun, 9 May 2010 22:44:48, Garrett Smith
Either you have a bunch of little functions that each call
getElementById or you have a bunch of little functions that expect an
element reference, or you have a decorator that does a bunch of things
and takes either an element reference or an id.

Most times you want to do so much more than set innerHTML.

No. Most times I just want to set innerHTML. Consider, for example, my
late-draft page $lag-pts.htm.

The above code did no more.

If it had done more to the element, then either it would have been bad
code for repeating gEBI in the same element when the result could have
been saved, or it would not have contained the quoted line.

If I wanted, in several parts of the code, to set both test and colour,
then I would write a routine WrytHue(ID, Str, Hue) .
 
G

Garrett Smith

David said:
[...]

ISTM from your queries that you simply lack experience in this area.

I'm not asking. Nobody is. You posted a bad API design idea based on
supposition and bullshit and I called you on it.
 
D

David Mark

Garrett said:
David said:
Garrett said:
David Mark wrote:
Garrett Smith wrote:
David Mark wrote:
Stefan Weiss wrote:
On 11/05/10 03:07, David Mark wrote:
Garrett Smith wrote:
David Mark wrote:
Garrett Smith wrote:
[...]

ISTM from your queries that you simply lack experience in this area.

I'm not asking. Nobody is. You posted a bad API design idea based on
supposition and bullshit and I called you on it.

How many times do you have to "call me" on such things to realize you
invariably turn out to be wrong. It seems to happen every other month
and then you feign amnesia. It's tiring.
 
G

Garrett Smith

David said:
Garrett said:
David said:
Garrett Smith wrote:
David Mark wrote:
Garrett Smith wrote:
David Mark wrote:
Stefan Weiss wrote:
On 11/05/10 03:07, David Mark wrote:
Garrett Smith wrote:
David Mark wrote:
Garrett Smith wrote: [...]

ISTM from your queries that you simply lack experience in this area.
I'm not asking. Nobody is. You posted a bad API design idea based on
supposition and bullshit and I called you on it.

How many times do you have to "call me" on such things to realize you
invariably turn out to be wrong. It seems to happen every other month
and then you feign amnesia. It's tiring.

Sorry that was a bit inflammatory.

AISI: The subject is "How do I modify the content of the current page".
Stockton proposed promoting the code to function `Wryt`. You said that
was not a good idea. I actually agree with that, but not for the reasons
given; none of this has anything to do with repaints, animation, or your
services.
 
G

Garrett Smith

Dr said:
In comp.lang.javascript message <[email protected]
september.org>, Sun, 9 May 2010 22:44:48, Garrett Smith



No. Most times I just want to set innerHTML. Consider, for example, my
late-draft page $lag-pts.htm.

I see some innerHTML in PopAll and DrawTall.

For the purpose of the FAQ entry, the focus is on answering the
question, not organizing abstractions.

Wryt is a global function that takes an id and a string and tries to
modify innerHTML of an element. The identifier "Wryt" is less
descriptive than innerHTML. It has nothing to do with the global object,
other than expecting that the element is in the same document that is
loaded in that window, and it does not even check to make sure that it
is before accessing its innerHTML.

For your site, it is probably easy to catch the problem of missing
element. However, for a page with entire sections of server-generated or
included content, it is a good idea to put in a feature test so that if
the element happens to be not included on the page, there is no error in
that case.

For example a popular website here in the US has a javascript error that
is related to an element being expected in the page, when it is not there.

https://post.craigslist.org/sfo/R/res/sfc/8

$(".ads textarea").val() is undefined postingForm.js (line 3)

https://post.craigslist.org/js/postingForm.js

jQuery finds no result, and so returns what is sometimes called "Null
Object" among patterns folks. The `val` method might be to do the same
and also return the empty string. Instead it returns undefined.

The code then tries to access the length property off val and since val
is undefined, a TypeError results.

For elements that the program does not create, it is a good idea for the
program to first test to determine if the element actually exists. For
example:

var el = document.getElementById("cassia");
if(el) {
el.innerHTML = "Not real cinnamon and carcinogenic.";
}
 
D

David Mark

Garrett said:
I see some innerHTML in PopAll and DrawTall.

For the purpose of the FAQ entry, the focus is on answering the
question, not organizing abstractions.

Wryt is a global function that takes an id and a string and tries to
modify innerHTML of an element. The identifier "Wryt" is less
descriptive than innerHTML. It has nothing to do with the global object,
other than expecting that the element is in the same document that is
loaded in that window, and it does not even check to make sure that it
is before accessing its innerHTML.

For your site, it is probably easy to catch the problem of missing
element. However, for a page with entire sections of server-generated or
included content, it is a good idea to put in a feature test so that if
the element happens to be not included on the page, there is no error in
that case.

For example a popular website here in the US has a javascript error that
is related to an element being expected in the page, when it is not there.

https://post.craigslist.org/sfo/R/res/sfc/8

$(".ads textarea").val() is undefined postingForm.js (line 3)

https://post.craigslist.org/js/postingForm.js

jQuery finds no result, and so returns what is sometimes called "Null
Object" among patterns folks. The `val` method might be to do the same
and also return the empty string. Instead it returns undefined.

It should simply blow up at that point. Returning an empty string would
be even more detrimental to the developer as such failures should be
immediately apparent.
The code then tries to access the length property off val and since val
is undefined, a TypeError results.

That's preferable to the caller than returning a bogus result, which
would cloak the mistake, making it less likely to be found and corrected.
For elements that the program does not create, it is a good idea for the
program to first test to determine if the element actually exists. For
example:

var el = document.getElementById("cassia");
if(el) {
el.innerHTML = "Not real cinnamon and carcinogenic.";
}

That's fine, but you don't want to do that in the guts of a GP framework.

Calling My Library's OO interface, you would do something like:-

var myEl = E('cassia');
if (myEl.element) {
myEl.setElementHtml('Not real cinnamon and carcinogenic.');
}

Without the check for the - element - method, the second call would
result in an immediate failure. Some might call this "unforgiving". I
call it sane. Who wants to bury mistakes?

And this is another reason why chaining is a bad strategy in most cases.
 
D

David Mark

David said:
It should simply blow up at that point. Returning an empty string would
be even more detrimental to the developer as such failures should be
immediately apparent.


That's preferable to the caller than returning a bogus result, which
would cloak the mistake, making it less likely to be found and corrected.


That's fine, but you don't want to do that in the guts of a GP framework.

Calling My Library's OO interface, you would do something like:-

var myEl = E('cassia');
if (myEl.element) {
myEl.setElementHtml('Not real cinnamon and carcinogenic.');
}

Oops, mixed up the API function name with the OO method.

myEl.setHtml('Not real cinnamon and carcinogenic.');
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]
september.org>, Wed, 12 May 2010 01:18:44, Garrett Smith
I see some innerHTML in PopAll and DrawTall.

The line in include1.js PopAll is reading innerHTML, not writing it :
Text = document.body ; Text = Text.textContent || Text.innerHTML

In gravity4.htm DrawTall, a reference Tl to the target element is used
to set a reference Ts to its style, as well as being used in
Tl.innerHTML = SetSpans( ... . There is no need there for Wryt, which
would wastefully re-determine that reference. I concede that using Wryt
would require one character fewer in source code.

In the HTML source of my site, "Wryt" appears about 200 times, and
innerHTML only about 50 times. Some of those 50 are in fact used in
defining Wryt for pages not using include1.js. Some are in text. Five
are in VBscript pages.

My "most times" is justified, and does not mean "always".


For the purpose of the FAQ entry, the focus is on answering the
question, not organizing abstractions.

Examples in FAQ answers should not show bad practice, unless that is
explicitly indicated. Look into US technical sites, and you will
commonly see unnecessary code repetition. If an opportunity for a
counter-example appears, it should be taken.

Wryt is a global function that takes an id and a string and tries to
modify innerHTML of an element. The identifier "Wryt" is less
descriptive than innerHTML. It has nothing to do with the global
object, other than expecting that the element is in the same document
that is loaded in that window, and it does not even check to make sure
that it is before accessing its innerHTML.

If the reference does not exist, that will generally be found on testing
the page and eliminated. Those who want to compute ID values in an
unreliable fashion can add a check, and something else to do instead.


But remember what I said - that a set of five
document.getElementById(String).innerHTML = string
would better be done with the equivalent five Wryt calls. If you want
the element reference to be checked in Wryt, you must want it also to be
checked in the original code - which makes the saving of using an
appropriate function so much the greater.
For your site, it is probably easy to catch the problem of missing
element. However, for a page with entire sections of server-generated
or included content, it is a good idea to put in a feature test so that
if the element happens to be not included on the page, there is no
error in that case.

Only if the action taken if the reference is not found will be
satisfactory. Merely omitting an action can be a grave error.

The absence of an appropriate error action is itself an error.
For elements that the program does not create, it is a good idea for
the program to first test to determine if the element actually exists.
For example:

var el = document.getElementById("cassia");
if(el) {
el.innerHTML = "Not real cinnamon and carcinogenic.";
}


That is a fine example of hiding an error; the reader will be unaware
that the displayed page is not as its author hoped it would be. The
pointy-headed manager who tests the page may well miss the error. That
is indeed bad practice - common as it may be in your commercial sites.
 
G

Garrett Smith

Dr said:
In comp.lang.javascript message <[email protected]
september.org>, Wed, 12 May 2010 01:18:44, Garrett Smith


The line in include1.js PopAll is reading innerHTML, not writing it :
Text = document.body ; Text = Text.textContent || Text.innerHTML

In gravity4.htm DrawTall, a reference Tl to the target element is used
to set a reference Ts to its style, as well as being used in
Tl.innerHTML = SetSpans( ... . There is no need there for Wryt, which
would wastefully re-determine that reference. I concede that using Wryt
would require one character fewer in source code.

Case in point: Ther are contexts where what Wrty does is inappropriate.
Examples in FAQ answers should not show bad practice,

OK. So it sounds like we agree that a global `Wryt` function is
inappropriate.

unless that is
explicitly indicated. Look into US technical sites, and you will
commonly see unnecessary code repetition. If an opportunity for a
counter-example appears, it should be taken.

The FAQ covers API design in one place: Code Guidelines.

http://jibbering.com/faq/notes/code-guidelines/#design

Comments on that welcome.
If the reference does not exist, that will generally be found on testing
the page and eliminated. Those who want to compute ID values in an
unreliable fashion can add a check, and something else to do instead.

Sounds like its time to play "broken record" again.

Again, the reference might be included in some sort of include file. THe
reference might need to be created by the script, but only once. In some
cases, doing nothing is acceptable. In other cases, the element might
need to be creative.

The FAQ is not going to become a toy example for made up context. ThZe
we are discussing is context-free. It shows innerHTML; not your Wrty
function, not David's "My LIbrary" whatever the hell it is that sets
innerHTML (poor fool cant' remember it himself), innerHTML is explained
as just innerHTML.
But remember what I said - that a set of five
document.getElementById(String).innerHTML = string
would better be done with the equivalent five Wryt calls. If you want
the element reference to be checked in Wryt, you must want it also to be
checked in the original code - which makes the saving of using an
appropriate function so much the greater.

The Wrty abstraction tells nothing of why it exists or what it does. It
does not check element exists and doees not provide any fallback for
when it doesn't.

An identifier `setElementInnerHTML` at least makse a little sense here,
but is just as pointless because it adds no value that cannot be
achieved with simply using innerHTML.
Only if the action taken if the reference is not found will be
satisfactory. Merely omitting an action can be a grave error.

How do you know that doing nothing when the element does not exist is
acceptable? The FAQ does not need any context.
The absence of an appropriate error action is itself an error.



That is a fine example of hiding an error;

No context is given.

What the code does (nothing) is not necessarily an error. The element
missing might indicate that the page is in a state where displaying that
message would be inappropriate and in that case, not displaying the
message would not be hiding an error.

Doing that might or might not be a mistake. Such conclusions, at this
point, would be hasty.

the reader will be unaware
that the displayed page is not as its author hoped it would be. The
pointy-headed manager who tests the page may well miss the error. That
is indeed bad practice - common as it may be in your commercial sites.
My commercial sites? Which sites are those? Are they making any money?
Because I sure could use that.
 
D

David Mark

Dr said:
In comp.lang.javascript message <[email protected]
september.org>, Wed, 12 May 2010 01:18:44, Garrett Smith


The line in include1.js PopAll is reading innerHTML, not writing it :
Text = document.body ; Text = Text.textContent || Text.innerHTML

In gravity4.htm DrawTall, a reference Tl to the target element is used
to set a reference Ts to its style, as well as being used in
Tl.innerHTML = SetSpans( ... . There is no need there for Wryt, which
would wastefully re-determine that reference. I concede that using Wryt
would require one character fewer in source code.

In the HTML source of my site, "Wryt" appears about 200 times, and
innerHTML only about 50 times. Some of those 50 are in fact used in
defining Wryt for pages not using include1.js. Some are in text. Five
are in VBscript pages.

My "most times" is justified, and does not mean "always".




Examples in FAQ answers should not show bad practice, unless that is
explicitly indicated. Look into US technical sites, and you will
commonly see unnecessary code repetition. If an opportunity for a
counter-example appears, it should be taken.



If the reference does not exist, that will generally be found on testing
the page and eliminated. Those who want to compute ID values in an
unreliable fashion can add a check, and something else to do instead.


But remember what I said - that a set of five
document.getElementById(String).innerHTML = string
would better be done with the equivalent five Wryt calls. If you want
the element reference to be checked in Wryt, you must want it also to be
checked in the original code - which makes the saving of using an
appropriate function so much the greater.


Only if the action taken if the reference is not found will be
satisfactory. Merely omitting an action can be a grave error.

The absence of an appropriate error action is itself an error.



That is a fine example of hiding an error; the reader will be unaware
that the displayed page is not as its author hoped it would be. The
pointy-headed manager who tests the page may well miss the error. That
is indeed bad practice - common as it may be in your commercial sites.

Absolutely. Scripts must look at the big picture. If required elements
are missing for a particular feature, it must be scrapped in its
entirety, not partially implemented with whatever is available.

This is another reason why the chaining style is a bad idea. It leads
to silent failures and/or failures with no recourse. But try to tell
that to a jQuery aficionado obsessed with "conciseness".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top