HTML-HTML5-DOM

 view release on metacpan or  search on metacpan

lib/HTML/HTML5/DOM.pm  view on Meta::CPAN

	use strict qw(vars subs);
	use mro 'c3';

	BEGIN {
		$HTML::HTML5::DOM::HTMLLabelElement::AUTHORITY = 'cpan:TOBYINK';
		$HTML::HTML5::DOM::HTMLLabelElement::VERSION   = '0.002';
	};
	
	our @ELEMENTS;
	BEGIN {
		@ELEMENTS = map { sprintf('{%s}%s', HTML::HTML5::DOM->XHTML_NS, $_) }
			qw/label/;
	}

	use XML::LibXML::Augment 0
		-names => [@ELEMENTS],
		-isa   => ['HTML::HTML5::DOM::HTMLElement'];

	__PACKAGE__->_mk_form_methods([qw/form/]);

	sub control
	{
		my ($self) = @_;
		
		my @controls;
		if ($self->hasAttribute('for'))
		{
			my $xpath = sprintf('//[@id="%s"]', $self->getAttribute('for'));
			@controls = $self->ownerDocument->findnodes($xpath);
		}
		else
		{
			@controls = grep { $_->can('labels') } $self->getElementsByTagName('*');
		}
		
		return $controls[0] if @controls;
		return;	
	}

	HTML::HTML5::DOMutil::AutoDoc->add(
		__PACKAGE__,
		'control',
		'Returns the control that this element acts as a label for.',
		);
}

{	package HTML::HTML5::DOM::HTMLLegendElement;

	use 5.010;
	use strict qw(vars subs);
	use mro 'c3';

	BEGIN {
		$HTML::HTML5::DOM::HTMLLegendElement::AUTHORITY = 'cpan:TOBYINK';
		$HTML::HTML5::DOM::HTMLLegendElement::VERSION   = '0.002';
	};
	
	our @ELEMENTS;
	BEGIN {
		@ELEMENTS = map { sprintf('{%s}%s', HTML::HTML5::DOM->XHTML_NS, $_) }
			qw/legend/;
	}

	use XML::LibXML::Augment 0
		-names => [@ELEMENTS],
		-isa   => ['HTML::HTML5::DOM::HTMLElement'];

	__PACKAGE__->_mk_form_methods([qw/form/]);
}

{	package HTML::HTML5::DOM::HTMLLIElement;

	use 5.010;
	use strict qw(vars subs);
	use mro 'c3';

	BEGIN {
		$HTML::HTML5::DOM::HTMLLIElement::AUTHORITY = 'cpan:TOBYINK';
		$HTML::HTML5::DOM::HTMLLIElement::VERSION   = '0.002';
	};
		
	our @ELEMENTS;
	BEGIN {
		@ELEMENTS = map { sprintf('{%s}%s', HTML::HTML5::DOM->XHTML_NS, $_) }
			qw/li/;
	}

	use XML::LibXML::Augment 0
		-names => [@ELEMENTS],
		-isa   => ['HTML::HTML5::DOM::HTMLElement'];

	sub value
	{
		die "TODO";
	}
}

{	package HTML::HTML5::DOM::HTMLLinkElement;

	use 5.010;
	use strict qw(vars subs);
	use mro 'c3';

	BEGIN {
		$HTML::HTML5::DOM::HTMLLinkElement::AUTHORITY = 'cpan:TOBYINK';
		$HTML::HTML5::DOM::HTMLLinkElement::VERSION   = '0.002';
	};
	
	our @ELEMENTS;
	BEGIN {
		@ELEMENTS = map { sprintf('{%s}%s', HTML::HTML5::DOM->XHTML_NS, $_) }
			qw/link/;
	}

	use XML::LibXML::Augment 0
		-names => [@ELEMENTS],
		-isa   => ['HTML::HTML5::DOM::HTMLElement'];

	__PACKAGE__->_mk_attribute_accessors(qw/
		disabled==boolean href==URI rel rev media hreflang target type
		relList=rel=LIST revList=rev=LIST



( run in 0.602 second using v1.01-cache-2.11-cpan-d7f47b0818f )