- From: Ville Skytta via cvs-syncmail <cvsmail@w3.org>
- Date: Sun, 10 Feb 2008 21:48:45 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/perl/modules/W3C/LinkChecker/bin
In directory hutz:/tmp/cvs-serv9349
Modified Files:
checklink
Log Message:
Take codebase into account when resolving object/@data.
Index: checklink
===================================================================
RCS file: /sources/public/perl/modules/W3C/LinkChecker/bin/checklink,v
retrieving revision 4.94
retrieving revision 4.95
diff -u -d -r4.94 -r4.95
--- checklink 10 Feb 2008 21:41:57 -0000 4.94
+++ checklink 10 Feb 2008 21:48:43 -0000 4.95
@@ -222,13 +222,9 @@
# TBD/TODO:
# - applet/@archive, @code?
-# - applet/@codebase: does not need to be dereferenceable but HTML 4 spec says
-# it may only point to subdirectories of the directory containing the current
-# document
# - bgsound/@src?
# - object/@classid?
# - object/@archive?
-# - object/@codebase: base URI for @classid, @data, @archive
# - isindex/@action?
# - layer/@background,@src?
# - ilayer/@background?
@@ -1476,8 +1472,11 @@
sub add_link
{
- my ($self, $uri, $line) = @_;
- $self->{Links}{$uri}{$line}++ if defined($uri);
+ my ($self, $uri, $base, $line) = @_;
+ if (defined($uri)) {
+ $uri = URI->new_abs($uri, $base) if defined($base);
+ $self->{Links}{$uri}{$line}++;
+ }
return;
}
@@ -1507,10 +1506,20 @@
# http://www.w3.org/mid/200802091439.27764.ville.skytta%40iki.fi
}
+ my $tag_local_base = undef;
+ if ($tag eq 'applet' || $tag eq 'object') {
+ if (my $codebase = $attr->{codebase}) {
+ # TODO: HTML 4 spec says applet/@codebase may only point to subdirs of
+ # the directory containing the current document. Should we do
+ # something about that?
+ $tag_local_base = URI->new_abs($codebase, $self->{base});
+ }
+ }
+
# Link attributes:
if (my $link_attrs = LINK_ATTRS()->{$tag}) {
for my $la (@$link_attrs) {
- $self->add_link($attr->{$la}, $line);
+ $self->add_link($attr->{$la}, $tag_local_base, $line);
}
}
@@ -1519,7 +1528,7 @@
for my $la (@$link_attrs) {
if (defined(my $value = $attr->{$la})) {
for my $link (split(/\s+/, $value)) {
- $self->add_link($link, $line);
+ $self->add_link($link, $tag_local_base, $line);
}
}
}
@@ -1546,7 +1555,7 @@
# Store the doctype
$self->doctype($1) if $1;
# If there is a link to the DTD, record it
- $self->add_link($3, $line) if (!$self->{only_anchors} && $3);
+ $self->add_link($3, undef, $line) if (!$self->{only_anchors} && $3);
}
}
Received on Sunday, 10 February 2008 21:48:58 UTC