![]() | |
#51
| |||
| |||
|
|
On Dec 9, 12:02 am, Peter Michaux <petermich... (AT) gmail (DOT) com> wrote: [snip] I didn't make a time test but I think the simulation of Array.prototype.filter will be very slow. I made a CSS selector Considering that the use of the filter wrapper only helps IE5 and under, it does make sense to duplicate its functionality in the gEBTN wrapper. But that function and other JS1.6 array method wrappers are useful for other purposes where speed is less of an issue. I think that we should deal with those shortly. |
#52
| |||
| |||
|
|
Even though the two getEBTN wrappers use different fallbacks for IE4 it looks like they could be combined into one just like I've done here with no real performance penalty. If some browsers had document.all and not element.all then that would be a problem but has that ever been the case? That one isn't likely. It was the gEBTN inference that I wanted to avoid. The previous discussion about this stemmed from the fact that most libraries make similar inferences about addEventListener (which requires three implementations: window, document and element.) It was noted that agents do exist that support that method for elements, but not for window. Do you have a link to that previous discussion? If so please post it No. when we get to events. I didn't know such a case existed. The source of that piece of information was Richard Cornford. The discussion concerning splitting up addEventListener and gEBTN wrappers was in a single thread. A search for "addEventListener" and "getElementsByTagName" in the last two months or so should find the posts. |
#53
| |||||
| |||||
|
|
On Dec 9, 9:13 am, David Mark <dmark.cins... (AT) gmail (DOT) com> wrote: On Dec 9, 11:20 am, Peter Michaux <petermich... (AT) gmail (DOT) com> wrote: On Dec 9, 4:32 am, David Mark <dmark.cins... (AT) gmail (DOT) com> wrote: On Dec 9, 12:02 am, Peter Michaux <petermich... (AT) gmail (DOT) com> wrote: [snip] I realize that the task of finalizing, adding and documenting each is a bottleneck, Yes. I am working on an automated testing system now and that will That's interesting. How will that work? The interesting part is that the testing framework needs to limit how much client side scripting is used as it is testing a client side scripting library. This is so even very old browsers can be tested. I'm using a series of communications between the client and server. The server orchestrates everything with a series redirects from test page to test page using redirects until all test pages have been run. The client logs test assertions (pass and fail) to the server by setting (new Image()).src since this is the oldest(?) way to communicate with the server. There will be extremely old browsers that can't do this and those browsers will require manual testing if they are to be tested at all. The only other requirement is that the browser can set window.location. I think this is the ultimate in a low tech automated system for testing. |
|
What I'm trying to do is focus which lower level functionality goes in first. Lower level functionality that is required by the higher level modules should have priority. The lower level functionality prerequisite to a particular module will necessarily be included before or at the time the higher level module is included. |
|
I no longer think that is even possible and window.onload is the only option. URL:http://peter.michaux.ca/article/553 |
|
I can't keep up on more than is going on right now. I didn't think |
|
think this project would be so popular! |
#54
| |||
| |||
|
|
On Dec 9, 4:32 am, David Mark <dmark.cins... (AT) gmail (DOT) com> wrote: On Dec 9, 12:02 am, Peter Michaux <petermich... (AT) gmail (DOT) com> wrote: [snip] I didn't make a time test but I think the simulation of Array.prototype.filter will be very slow. I made a CSS selector Considering that the use of the filter wrapper only helps IE5 and under, it does make sense to duplicate its functionality in the gEBTN wrapper. But that function and other JS1.6 array method wrappers are useful for other purposes where speed is less of an issue. I think that we should deal with those shortly. Prototype.js focuses heavily on these sort of iterators (e.g. filter, each, find, etc). The other code in Prototype.js uses these iterators and this makes the library difficult to use in pieces. The |
|
foundational code is very large and must be included just for a small piece of higher level functionality. I want to avoid this type of interdependence. I think that code should be able to stand on it's own or have very few dependencies. |
#55
| |||
| |||
|
|
Even though the two getEBTN wrappers use different fallbacks for IE4 it looks like they could be combined into one just like I've done here with no real performance penalty. If some browsers had document.all and not element.all then that would be a problem but has that ever been the case? That one isn't likely. It was the gEBTN inference that I wanted to avoid. The previous discussion about this stemmed from the fact that most libraries make similar inferences about addEventListener (which requires three implementations: window, document and element.) It was noted that agents do exist that support that method for elements, but not for window. Do you have a link to that previous discussion? If so please post it No. when we get to events. I didn't know such a case existed. The source of that piece of information was Richard Cornford. The discussion concerning splitting up addEventListener and gEBTN wrappers was in a single thread. A search for "addEventListener" and "getElementsByTagName" in the last two months or so should find the posts. I found it. URL:http://groups.google.com/group/comp....wse_frm/thread... I don't think that thread particularly suggests that a gEBTN wrapper must be split into two functions although I suppose it could be. |
#56
| ||||||||||||||||||||||
| ||||||||||||||||||||||
|
|
On Dec 9, 11:07 pm, Peter Michaux <petermich... (AT) gmail (DOT) com> wrote: I think the project must be inclusive to all participation. So far it mostly going "wild on the party" :-) as the major |
|
participant s keep making monstrous paranoid all-in-one don't-trust- anyone snippets of code where each snippet intended to accomplish a single very primitive task. If the Code Worth project ever gets big then it will be an army of soldiers where everyone carries on his armor, food for the whole campaign, all necessary items, 200 pounds of old family albums and beloved books. And before to ask for fire from another solder, each one first makes a full scale fortification around him so taking the lighter through the small hole in the wall after triple check. Evidently the one who asked does exactly the same before to get the lighter back: so in order of two to fire their cigars the army has to make a stop for a day or two each time. |
|
Such snippets may have some limited usability for bookmarklets and thingies (inline anonymous functions for element event handlers). |
|
God forbids to make a _library_ of all these things together. If one |
|
at least pretending to be on OOP path then one shold start from the basics: from the modularity. OOP is not about C out of B out of A out of ground bottom - it is just a possible but not necessary consequence of OOP approache. OOP is about everyone doing its own thing and this thing only. |
|
And what an anancastic sub is that so far? Are you trying to make the resulting lib being able to run only on Cray clusters? First of all |
|
the whole problem is totally artificial, because as of the end of 2007 the options are: |
|
1) use document.getElementById 2) drop the sick sh** someone is using to run your script on. |
|
Being a paranoiac it could be 3 options 1) use document.getElementById 2) use document.all if no 1) |
|
3) drop the sick sh** someone is using to run your script on if neither 1) nor 2) |
|
So the entire - already paranoid for practical usage - code is: if (document.getElementById) { $ = function(id){ return document.getElementById(id); }; } |
|
else if (document.all) { $ = function(id){return document.all(id);}; |
|
} else { |
|
$ = function(id){/* undefined */}; } |
|
And then in Help file one writes something like: com.something.utils.$(String id) |
|
Takes single string argument and returns a reference to DOM element with specified ID. |
|
No behavior specified for arguments other than string type. |
|
If DOM element with requested ID doesn't exists then returns null value. |
|
If the page contains several elements with the same ID then returns the first element on the page going from the top with such ID. If user agent doesn't support neither standard nor proprietary tools for DOM element reference retrieval then returns undefined value. |
|
Other words: 1) The main logic is moved to specification, not to runtime method. |
|
Who wants a working program he will read it, who really wants to crash the program he will do it no matter what. |
|
2) Runtime performance is the King, fall-back protection is the sh** - as long as no security violation is involved. |
#57
| |||
| |||
|
|
On Dec 10, 12:48 am, Peter Michaux <petermich... (AT) gmail (DOT) com> wrote: On Dec 9, 4:32 am, David Mark <dmark.cins... (AT) gmail (DOT) com> wrote: On Dec 9, 12:02 am, Peter Michaux <petermich... (AT) gmail (DOT) com> wrote: [snip] I didn't make a time test but I think the simulation of Array.prototype.filter will be very slow. I made a CSS selector Considering that the use of the filter wrapper only helps IE5 and under, it does make sense to duplicate its functionality in the gEBTN wrapper. But that function and other JS1.6 array method wrappers are useful for other purposes where speed is less of an issue. I think that we should deal with those shortly. Prototype.js focuses heavily on these sort of iterators (e.g. filter, each, find, etc). The other code in Prototype.js uses these iterators and this makes the library difficult to use in pieces. The I tend to avoid using them in low-level modules for performance reasons, but the code itself is very compact, so I do include it in my base module. |
|
I have considered moving it to its own module, which would only be required by those higher-level modules that use it. foundational code is very large and must be included just for a small piece of higher level functionality. I want to avoid this type of interdependence. I think that code should be able to stand on it's own or have very few dependencies. Depends on what it does. All but a couple of my modules require the base module. Most have no other dependencies, but the highest level modules and widgets typically depend on two or three lower level modules. In general, as granularity is maximized, redundancy is minimized and dependencies increase accordingly. |
#58
| |||
| |||
|
|
As granularity is increased the amount of code served to the client that is not necessary for a given page is also increased. This is the bloat problem that all of the popular libraries seem to have. |
#59
| ||||
| ||||
|
|
On Dec 9, 12:45 pm, Peter Michaux <petermich... (AT) gmail (DOT) com> wrote: I have always tested manually and it is time-consuming. |
|
I can't keep up on more than is going on right now. I didn't think This automated testing suite should help that. But if only one person is handling documentation and everybody else is adding and scrutinizing code, then a bottleneck will always exist. |
|
think this project would be so popular! It will certainly fill a glaring need once the basic foundation is in place. |
|
After that, I'm sure the popularity will increase exponentially. |
#60
| |||
| |||
|
|
On Dec 10, 1:13 am, Peter Michaux <petermich... (AT) gmail (DOT) com> wrote: Even though the two getEBTN wrappers use different fallbacks for IE4 it looks like they could be combined into one just like I've done here with no real performance penalty. If some browsers had document.all and not element.all then that would be a problem but has that ever been the case? That one isn't likely. It was the gEBTN inference that I wanted to avoid. The previous discussion about this stemmed from the fact that most libraries make similar inferences about addEventListener (which requires three implementations: window, document and element.) It was noted that agents do exist that support that method for elements, but not for window. Do you have a link to that previous discussion? If so please post it No. when we get to events. I didn't know such a case existed. The source of that piece of information was Richard Cornford. The discussion concerning splitting up addEventListener and gEBTN wrappers was in a single thread. A search for "addEventListener" and "getElementsByTagName" in the last two months or so should find the posts. I found it. URL:http://groups.google.com/group/comp....wse_frm/thread... I don't think that thread particularly suggests that a gEBTN wrapper must be split into two functions although I suppose it could be. As I recall, my question was whether it would be excessively paranoid |
|
to do so and the answer was no. As for addEventListener, it was suggested that that would have to be done in at least two parts if one- off testing was to be used. I ended up doing it in three parts (element, document and window.) It didn't result in bloated code as I used factories to generate the functions. In fact, the base module that includes add/removeEventListener, gEBTN, gEBI, all of the feature testing foundation previously discussed, plus iterator code and several other low level abstractions is less then 10K minified. It has become an arbitrary rule for me to keep all modules under 10K and granularity requirements have tended to confirm that as a realistic limit. |
![]() |
| Thread Tools | |
| Display Modes | |
| |