/[suikacvs]/markup/hlink/implementation/hlink-script.js
Suika

Contents of /markup/hlink/implementation/hlink-script.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download) (as text)
Sun Jul 6 23:49:32 2003 UTC (23 years, 2 months ago) by w
Branch: MAIN
CVS Tags: HEAD
File MIME type: application/javascript
2003-03-01 06:49 version

1 const XHTML1NS = 'http://www.w3.org/1999/xhtml';
2 const HLinkNS = 'http://www.w3.org/2002/06/hlink';
3 const XLinkNS = 'http://www.w3.org/1999/xlink';
4 const tempNS = 'urn:x-suika-fam-cx:markup:temporary';
5
6 function linkizeHTML (doc) {
7 var eLinks = doc.getElementsByTagNameNS (XHTML1NS, 'link');
8 for (var i = 0; i < eLinks.length; i++) {
9 if (eLinks[i].getAttribute ('type').toLowerCase () == 'application/x-hlink+xml'
10 && eLinks[i].getAttribute ('rel') == 'stylesheet' //.match (/stylesheet/i)
11 ) {
12 linkizeByHTMLLinkElement (eLinks[i]);
13 }
14 }
15 }
16
17 function linkizeByHTMLLinkElement (eLink) {
18 var oHLink = eLink.ownerDocument.createElementNS (XHTML1NS, 'object');
19 oHLink.setAttributeNS (tempNS, 'HLinkStatus', 100);
20 oHLink.setAttribute ('data', eLink.getAttribute ('href'));
21 //oHLink.setAttribute ('type', 'application/xml');
22 oHLink.style.display = 'block';
23 oHLink.style.width = 0;
24 oHLink.style.height = 0;
25 oHLink.addEventListener ('load', function () {
26 var hlink = oHLink.contentDocument.getElementsByTagNameNS (HLinkNS, 'hlink');
27 for (var k = 0; k < hlink.length; k++) {
28 linkizeElement (hlink[k]);
29 }
30 }, false);
31 eLink.ownerDocument.documentElement.appendChild (oHLink);
32 }
33
34