Jump to content
  • Welcome Guest

    For an ad free experience on Online Baptist, Please login or register for free

Opera


Recommended Posts

  • Members
That's weird, because when I tested Firefox in any website I built, any recent standard doctype swithed it to stards mode, which is the only reason html 5 has a doctype at all. Perhaps that certain doctype you posted switches a special behavior such as almost standards mode in Firefox? I'll do a little research, but in theory, and in my personal experience, all browsers switch to standards mode with a standard doctype.

Edit: OK, I found this (certain doctypes, including your's actually stay in quirks mode):
http://hixie.ch/tests/adhoc/compat/mozi ... rks%20mode

So actually, you're switching the browsers into quirks mode and your site doesn't look right in Firefox when in standards mode.

These so-called "standards" seem to be more of an annoyance than a help. For example, why in the world shouldn't you be able to refer to an ellment directly, in javascript, rather than having to go through the "getElementById()" nonsense. What moron thought of that "standard"? Firefox is the only browser that gets in a tizzy if you go refer to an element directly instead of jumping through these silly hoops.
Link to comment
Share on other sites

  • Replies 33
  • Created
  • Last Reply

Top Posters In This Topic

  • Members
These so-called "standards" seem to be more of an annoyance than a help. For example' date=' why in the world shouldn't you be able to refer to an ellment directly, in javascript, rather than having to go through the "getElementById()" nonsense. What moron thought of that "standard"? Firefox is the only browser that gets in a tizzy if you go refer to an element directly instead of jumping through these silly hoops.[/quote']

While I do agree that document.getElementById() is a bit cumbersome to write out for each element, it is there for a very good reason. Suppose you had an element with an ID that was also a Javascript keyword? Your script could then generate an error if you don't use doc.getElem... Also suppose you had a variable and an element by the same name; which should it refer to? It will refer to the variable with no way to get to the element. Also, iterating through a dynamic number of elements named something like field1, field2, field3, etc. with no fixed number is pretty much impossible without getElementById. Microsoft's proprietary (tho Opera copied this too) document.all[] sort of acheives the same thing.

To make it shorter, I always just asign a variable to an element like this when I need to perform multiple operations on it:
var element = document .getElementById("element");
element.dosomethingtoit();
element.property = "whatever";

Also, some javascript frameworks make a shortcut along the lines of this:
function $(element) { return document.getElementById(element); }

So then, instead of typing document.getElementById every time, you could just call: $("elementID");
Link to comment
Share on other sites

  • 1 month later...
  • Members

That's actually a non-standard DTD even though it throws the browsers into standards mode and the xmlns attribute is only used with xhtml, so you actually have an error in there. The xmlns:v is also unnecessary and non-standard there.

Better DTDs to use are html 4.01 strict or transitional or xhtml 1.0 strict or transitional, depending on your coding style. I personally use xhtml 1.0 strict (although I serve it as html) because I like to use only strict html if I can and I like the xml style of coding.

- HTML 4.01 Strict (requires strict html)

- HTML 4.01 transitional (more forgiving)

- XHTML 1.0 Strict (requires strict xhtml and the xmlns attribute)

- XHTML 1.0 Transitional (more forgiving but still requires well-formed xhtml and the xmlns attribute)

You can also switch the browser into standards mode using the upcoming HTML 5's doctype, which is simply

Not that I care because I only use Firefox and Opera (although I prefer firefox because of plugins I just can't live without and opera is a proprietary browser) but the only problem with html strict is that Internet Explorer (at least 6 which you'd be surprised how many people still use, I'm not sure about 7) completely ignores any of these standards.
Link to comment
Share on other sites

  • Members
Not that I care because I only use Firefox and Opera (although I prefer firefox because of plugins I just can't live without and opera is a proprietary browser) but the only problem with html strict is that Internet Explorer (at least 6 which you'd be surprised how many people still use' date=' I'm not sure about 7) completely ignores any of these standards.[/quote']
Well, not completely, but mostly ignores them.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...