21 |
|
|
22 |
if ({ |
if ({ |
23 |
## Read-only attributes (trivial accessors) |
## Read-only attributes (trivial accessors) |
24 |
|
namespace_uri => 1, |
25 |
owner_element => 1, |
owner_element => 1, |
26 |
}->{$method_name}) { |
}->{$method_name}) { |
27 |
no strict 'refs'; |
no strict 'refs'; |
28 |
eval qq{ |
eval qq{ |
29 |
sub $method_name (\$) { |
sub $method_name (\$) { |
|
if (\@_ > 1) { |
|
|
require Carp; |
|
|
Carp::croak (qq<Can't modify read-only attribute>); |
|
|
} |
|
30 |
return \${\$_[0]}->{$method_name}; |
return \${\$_[0]}->{$method_name}; |
31 |
} |
} |
32 |
}; |
}; |
38 |
eval qq{ |
eval qq{ |
39 |
sub $method_name (\$) { |
sub $method_name (\$) { |
40 |
if (\@_ > 1) { |
if (\@_ > 1) { |
41 |
\${\$_[0]}->{$method_name} = ''.$_[1]; |
\${\$_[0]}->{$method_name} = ''.\$_[1]; |
42 |
} |
} |
43 |
return \${\$_[0]}->{$method_name}; |
return \${\$_[0]}->{$method_name}; |
44 |
} |
} |
53 |
|
|
54 |
## The |Node| interface - attribute |
## The |Node| interface - attribute |
55 |
|
|
56 |
## Spec: |
sub local_name ($) { |
57 |
## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-F68D095> |
## TODO: HTML5 |
58 |
## Modified: <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-1841493061> |
return ${+shift}->{local_name}; |
59 |
|
} # local_name |
60 |
|
|
61 |
|
sub manakai_local_name ($) { |
62 |
|
return ${+shift}->{local_name}; |
63 |
|
} # manakai_local_name |
64 |
|
|
65 |
|
sub namespace_uri ($); |
66 |
|
|
67 |
## The name of the attribute [DOM1, DOM2]. |
## The name of the attribute [DOM1, DOM2]. |
68 |
## Same as |Attr.name| [DOM3]. |
## Same as |Attr.name| [DOM3]. |
71 |
|
|
72 |
sub node_type () { 2 } # ATTRIBUTE_NODE |
sub node_type () { 2 } # ATTRIBUTE_NODE |
73 |
|
|
|
## Spec: |
|
|
## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-F68D080> |
|
|
## Modified: <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-1841493061> |
|
|
|
|
74 |
## The value of the attribute [DOM1, DOM2]. |
## The value of the attribute [DOM1, DOM2]. |
75 |
## Same as |Attr.value| [DOM3]. |
## Same as |Attr.value| [DOM3]. |
76 |
|
|
77 |
*node_value = \&value; |
*node_value = \&value; |
78 |
|
|
79 |
|
sub prefix ($;$) { |
80 |
|
## TODO: setter |
81 |
|
return ${+shift}->{prefix}; |
82 |
|
} # prefix |
83 |
|
|
84 |
## The |Attr| interface - attribute |
## The |Attr| interface - attribute |
85 |
|
|
86 |
## TODO: HTML5 case stuff? |
## TODO: HTML5 case stuff? |