By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,971 Members | 907 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,971 IT Pros & Developers. It's quick & easy.

Singleton desing patter approach without function expressions...

P: n/a
I am designing the library, which will hidden all its functions within
singleton object ... So for clients
they will use it like [functional_prefix].[function_name] eg.

system.getElementWithId('ruler');
At library side, i will use constructs like follows (at global scope)
eg.

function System() {

function _getElementWithId(id) {
/*
GENERIC CODE (using first DOM getElementById(id) and if not
successful
using document.all with some checks...)
*/
}

/*
MORE UTIL FUNCS
*/

this.getElementWithId = _getElementWithId;
/*
MORE ASSIGMENTS like
this.[util_method] = _[util_method];
*/

}

var system = new System();

System = null; /* since System constructor is desinged to produce
singletons, and it
should not be visible after singleton
instantiation... */

My question is simple, can i use construct like:

System = null;

, to redefine constructor System reference to null ? If not, then how i
should do it ?
Also remember that i can't use function expressions like

function(...) { }

I will appreciate somebody knowlegable to lighten my problem...

Best regards
Luke Matuszewski

Feb 5 '06
Share this Question
Share on Google+
56 Replies


P: n/a
VK wrote:
With Internet Explorer 6 or later, when you use the !DOCTYPE
declaration to switch on standards-compliant mode, the width and
height properties specify the distance between the left and right
edges and top and bottom edges of the bounding box, respectively.
...
So the minimum reqirement is:
Detect that this is IE
and
Detect that it's in quirk mode
Your solution?


What do you really want to know?
Meaning, what do you want to do in script that requires you to know which
box model IE is using?

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Feb 13 '06 #51

P: n/a
VK

Matt Kruse wrote:
What do you really want to know?
Meaning, what do you want to do in script that requires you to know which
box model IE is using?


Never mind: I've got so upset and overall bitchy over the last week
that I've forgotten about IE pre-processor instructions (/*@cc_on*/)
That solves my problem in the no-fail way.

Overall it was about offsetHeight / offsetWidth for VML drawings (all
around my SVL+VML = SVL project)

Ceterum censeo Array jagged est :-)

Feb 13 '06 #52

P: n/a
VK wrote:
Richard Cornford wrote:
Stop thinking in terms of browsers and identify the question
you really need to have answered. You want to know something
about the meaning of offset values so that is what the
question you need answering relates to.
Strange question.


Not really. It is a sort of test; are you capable of analysing a problem
to the point of identifying the real issue, and so seeing the question
you need answered or will you just fixate on browser detecting and write
another brittle, unreliable maintenance-heavy script.
Nevertheless: <snip> <quote>
Compliant Behavior

... , the width and height properties specify the distance
between the left and right edges and top and bottom edges
of the bounding box, respectively. ...

Noncompliant Behavior

... , the width property includes the object's content box, plus
the values of the following properties: border-left, border-right,
padding-left, and padding-right. ... <snip> </quote>
In standards mode the CSS width/height does not include the borders and
padding, while in quirks mode it does. Since the offsetWidth/Height
properties of a block element state the dimensions of the block
including the borders and padding all you have to do is compare the
offsetWidth/Height of a suitable element with its specified CSS
width/height and if the offset values exceed the CSS values that the CSS
values are defining distances excluding borders and padding.

And that test will tell you no more, and no less, than the disposition
of the CSS width/height properties on every browser that exposes the
appropriate properties, past present and future, and without any
interest in or dependency upon the web browser in question.
There is only one browser implementing IE's Box Model
in quirk mode,
Given that you have a superficial familiarity with two or three web
browsers, in their default configurations, you are not the person to be
generalising about web browsers. As it happens IceBrowser 5 did a very
good job of reproducing the IE box model, it may not be alone in that.
and overall only one known browser
Known to you, don't forget that you don't know much really (and
sometimes less and less as time goes on).
implementing a different box model
in quirk mode: this is IE.
False!
So the minimum reqirement is:

Detect that this is IE
and
Detect that it's in quirk mode
Look at that, you posted the definition of the differences between
standards mode and quirks mode and didn't stop to read the words and see
that they effectively state the question you wanted answered.
Your solution?


Do more work on problem analysis and logic, you will find them
invaluable skills in programming.

Richard.
Feb 13 '06 #53

P: n/a
VK
W3C response for the proposal to update 4.01 Strict:
I'm afraid it's completely pointless to suggest changes to HTML 4.
It's frozen; all work on HTML specs is oriented towards XHTML and
specifically XHTML 2.0. Even reported simple _technical_ errors (in
the way things are presented, as opposite to the intended meaning) in
HTML 4 specs haven't been fixed. And probably won't.


As totally expected.

Lucky there are still people with a non-damaged perception of the
reality like <http://www.whatwg.org/>. Their HTML 5 and Form 2.0 are
exactly what I had in my mind. It is good to know that you are not a
nut, but someone triple-W'ed is... or at least that you are not the
only nut in the block :-)

Feb 17 '06 #54

P: n/a
VK wrote:
W3C response for the proposal to update 4.01 Strict: [...]

^^^^^^^^^^^^
Nonsense.
PointedEars
Feb 17 '06 #55

P: n/a
VK

Thomas 'PointedEars' Lahn wrote:
VK wrote:
W3C response for the proposal to update 4.01 Strict: [...]

^^^^^^^^^^^^
Nonsense.


What exactly?

The response text? That it's from W3C functionnairs? (it is) That it's
a response?

Feb 17 '06 #56

P: n/a
VK wrote:
Thomas 'PointedEars' Lahn wrote:
VK wrote:
> W3C response for the proposal to update 4.01 Strict: [...]

^^^^^^^^^^^^
Nonsense.


What exactly?

The response text? That it's from W3C functionnairs? (it is)


Not at all. It is a statement from a (respected) individual on a public
mailing list, as Google shows easily:

<URL:http://lists.w3.org/Archives/Public/www-html/2006Feb/0083.html>

Are you deliberately making a fool of yourself?

Or are you just trolling? You would have included the reference to the
mailing list archives if you were not.
PointedEars
Feb 17 '06 #57

56 Replies

This discussion thread is closed

Replies have been disabled for this discussion.