Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
DOM scripting help (fixing q cite linking)
Old 06-25-2007, 09:16 PM DOM scripting help (fixing q cite linking)
Moldarin's Avatar
Extreme Talker

Latest Blog Post:
Keyword Density and Title Tags
Posts: 201
Trades: 0
Hi,

I know HTML 5 is not nearly ready yet. However I found one thing I want to start using at once:
Quote:
Originally Posted by HTML 5 : Working Draft — 23 June 2007
If the cite attribute is present, it must be a URI (or IRI). User agents should allow users to follow such citation links.
I thought this could be done with some clever JavaScripting/DOM. As I picture it:
Code:
<q cite="http://www.com/">Example quote</q> from <cite>source</cite>.
should become
Code:
<q cite="http://www.com/"><a href="http://www.com/">Example quote</a></q> from <cite>source</cite>.
Sadly I know way to little of JavaScript/DOM to make this myself. So I was wondering if anyone where up for the task of creating a cleaver something that would regonize http:// and https:// cite attributes in Q's and put an a tag link in the quote?

Pretty please?
__________________
I do not share ad revenue.
Moldarin is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-26-2007, 05:59 AM Re: DOM scripting help (fixing q cite linking)
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
There is a flaw in your logic....

In {X}Html, there is no <q> tag.
As such, the browser will ignore it simply, and not display it's content.

From your idea, what must be done is:
1) When the page is loaded, get every tag named "q"
2) In those elements list, parse every childs, and get the "cite" element and attribute
3) create a span after the <q> tag
4) create a "a" tag into the span, with the cite attribute as the href of the "a"
5) create a text node inside the "a" with the value of the element "q" as the link anchor

But I really don't see the point of bothering with this right now.
What's the advantage of this, when compared to add an link in your actual blockquotes ?
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 06-26-2007, 09:48 AM Re: DOM scripting help (fixing q cite linking)
Moldarin's Avatar
Extreme Talker

Latest Blog Post:
Keyword Density and Title Tags
Posts: 201
Trades: 0
Quote:
Originally Posted by tripy View Post
There is a flaw in your logic....

In {X}Html, there is no <q> tag.
As such, the browser will ignore it simply, and not display it's content.
Check the current and upcomming spesifications. There is indeed a q (quoted text) tag in (5)HTML.

I have got help in other forums by the way:

http://my.opera.com/community/forums....dml?id=194561
http://www.webdeveloper.com/forum/sh...d.php?t=152641
__________________
I do not share ad revenue.
Moldarin is offline
Reply With Quote
View Public Profile
 
Old 06-26-2007, 10:30 AM Re: DOM scripting help (fixing q cite linking)
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Ok...

I've been proven wrong.
I was persuaded that when a browser encountered a tag it didn't knew, it was discarding it.

But trying this:
HTML Code:
<html>
  <body>
  <q>I'm Qute</q>
  </body>
</html>
worked....
FF even added double quotes to it.

I'm stumped.

Quote:
Check the current and upcomming spesifications.
Yeah, in the upcoming specifications.
Those are yet not reviewed and surely far from being accepted . Don't think about the browser implementation for years to come.
Xhtml 1.0 became an official recommendation of the w3c on january 2000.
It's support is still widely variable from a browser to another yet.

So, basically, I'm wondering: "why do you want to use it ?"
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 06-26-2007, 10:56 AM Re: DOM scripting help (fixing q cite linking)
Moldarin's Avatar
Extreme Talker

Latest Blog Post:
Keyword Density and Title Tags
Posts: 201
Trades: 0
Because I want to link to my quotations. I have been including cites n my <q>s for years... So. I figured it was time to put them all into use.

As I quoted from HTML 5: <q>s ith URI cites should be treated as links.

Note that all browsers but IE adds quotes. This CSS code applies italic to IE instead so the quote becomes distringisable from the rest of the text. Quite useful.

Code:
q { font-style: italic; quotes: "\0022" "\0022" "\0027" "\0027"; }
q::before { open-quote; }
q::after { close-quote; }
:lang(en-GB) { quotes: "\2018" "\2019" "\201C" "\201D"; }
:lang(en), :lang(en-US) { quotes: "\201C" "\201D" "\2018" "\2019"; }
html > body q { font-style: normal; !important }
__________________
I do not share ad revenue.

Last edited by Moldarin; 06-26-2007 at 11:23 AM..
Moldarin is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to DOM scripting help (fixing q cite linking)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.21456 seconds with 12 queries