Link to home
Start Free TrialLog in
Avatar of Sivakatirswami
Sivakatirswami

asked on

Why is <a href... target="_blank"> flagged as invalid in XHTML strict?

Context checking syntax on web page with:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

run syntax checker in BBedit (mac html editor)... line containing:

"<a href="/resources/multi-media/dws_youth/" target="_blank">"  is flagged:  
========
 Document type doesn't permit attribute “target” within element “<a>”
========

Why? I can't find any reference to deprecation for "target" and my understanding is _blank,  _self, _parent, _top  are all valid.
And the CSS for this is still in not standardized (see: http://www.w3.org/TR/2004/WD-css3-hyperlinks-20040224/)

So, why is BBEdit's syntax checking flagging this? and what are the alternatives? Or is it an access "philosophical"  issue having to do with "let there be no pop-ups!" that is built into the XHTML 1.0 specification, and if so, can you point me to the www.w3.org docs on this?

 I tend to waffle between using a new top window for tangential related content, where the user may want to keep the parent page, and his scrolled down position wthin it, alive...vs simply going to the link and if he wants, he can just go back. But he loses his scroll position and is forced to scroll down again to pick up where he left off...I myself find this annoying... espcially where the new windows are displaying examples which are contained in separate documents... you *really* want to keep your parent page alive and in your last scroll position.

But, if syntax checkers are barking at "target" there must be something official somewhere?

Any and all insights welcome

Thanks
Sivakatirswami
Avatar of StormyWaters
StormyWaters
Flag of United States of America image

See this PAQ:
https://www.experts-exchange.com/questions/21246480/Target-attribute-in-XHTML-1-1.html

Also consider why you're using XHTML in the first place. Do you really need the XML capabilities for your site or are you using it because it's "trendy"?  If you don't really need it, consider using HTML 4.01 Strict, this is the doctype. I'm sure Cd& will give you tons and tons of reasons why not to use XHTML unless you need it.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Target is only valid for the transitional and frameset DTDs of XHTML1.0 and has been dropped completely in XHTML1.1

The lack of support for alternatives is one of the reasons to stay away from theXHTML standard until it matures by address the lack of both forward and backward compatibility.  The there is no migration path, and the standard as is sits is going dead end leaving those using it isolted from mainstream development.

Most of the top-experts in the web topics on this site and many others are recommending HTML4.01 strict as the place to be until W3C gets its act together on the co-ordination of XHTML, CSS3, and the DOM standards.

Cd&
Avatar of Sivakatirswami
Sivakatirswami

ASKER

I am admittedly not well informed on these issues and, yes, if that means going with what seems to be the "trend" because one wants one's pages to be at the highest standards possible... then yes, one could call that "trendy" but not to be "cool" as such. Just doing the best I can to keep our web pages from being what they once were: complete and total, unmaintainalbe gobblety-gook (smile)

I guess in my attempts to upgrade I may have reached too far, unknowingly.

More practially speaking,  I'm using XHTML only as a way to enforce, what I thought was correct syntax, especially for standalone tags like <br /> which I understand should be self-closing... and by setting "Tidy" to clean up these things as well, automatically. And because I was hoping that using this doc type might help get a grip on the garbage that is created by such tools as GoLive, FrontPage etc. in the hands of those who really a) don't know what they are doing and b) have no interest in "clean code" ... I have, in my conversion to CSS and pure structural mark up of web pages become, perhaps an overzealous  "clean code fanatic..."

OK, thanks for the input. I had zero concept that XHTML could be anything but "good for you." I'll try HTML4.01 strict....

Question: are unclosed stand along tags OK? <br> <hr>  or will 4.01 strict enforce <br  />??  well, I guess I will find out soon enough

Thanks for the heads up on the W3C muddle... Some of us tend think there is God, and then W3C (smile)  (it used to be God and then Doctors...)

Sivakatirswami







HTML4.01 will recognize but not enforce closing of standalone tags.  From a tag/attribute support standpoint it is close to where a workable XHTML standard will have to be.

Cd&
Before I close this thread I have to ask, as I will certainly have to answer this to others on our team:

 "There is no migration path, and the standard as is sits is going dead end leaving those using it isolted from mainstream development."

What exactly  does this mean? That web pages with this doctype top on the first line will break in the future? Presently, we are not having any browser rendering issues at all.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

Sivakatirswami
Break? Probably not;

 Having rendering problems... possibily inconsistentcies like the differences between IE5.0 and IE5.5 that require coding changes, or the differences we see between running with a strict doctype, and running quirks mode for both Mozilla and IE, that switch can result in scripting error.

Validation errors ... almost a certainty.

The problem is really with the browser manufacturers if they do not support a given standard, then special provision required for it are incorporated into the browsers, and generaly reamin across version.  Right now IE support for XHTML is so weak the even with a strict XHTML 1.01 doctype, it can be thrown bck into quirks mode from other elements in the page that it does not understand like and invalid namespace on the HTML tag, or following the specs on doing <?xml as the first tag.

I can't predeict the future, I can only go by what has happened in the past.  When the browser manufacturers have deadended in the past, rather than try and retrace thier steps and give us an easy ride the jsut start  a new road through the wilderness and we get a wild ride while we work out what the new bugs are.

As a result I tend to be conservative about jumping on a standard until it is clear that it is going to be a widely supported standard.

Cd&
ASKER CERTIFIED SOLUTION
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Cd& That's what I needed to hear.
Glad we could help.  Thanks for the A. :^)

Cd&
You're welcome. may not have been what I *wanted* to hear, but it was what I *needed* to know...

This may sound wierd, but I may stick with the XHTML doctype and just chop the DTD... just to be sure some of my web page editors stay in spec... They are in love with WSIWIG. and GoLive is too lenient about what it generates in the background... and by setting XHTML strict and asking them to run their syntax checker... it seems to do a better job of not leaving  trails of empty junk behind on the page

Sivakatirswami
It sounds like a plan to me.  I don't see any landmines you can step on doing that.

Cd&