Class HTML5::TreeBuilders::Hpricot::Element::AttributeProxy
In: lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb
Parent: Object

A call to Hpricot::Elem#raw_attributes is built dynamically, so alterations to the returned value (a hash) will be lost.

AttributeProxy works around this by forwarding :[]= calls to the raw_attributes accessor on the element start tag.

Methods

Public Class methods

[Source]

    # File lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb, line 95
95:           def initialize(hpricot)
96:             @hpricot = hpricot
97:           end

Public Instance methods

[Source]

     # File lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb, line 99
 99:           def []=(k, v)
100:             @hpricot.stag.send(stag_attributes_method)[k] = v
101:           end

[Source]

     # File lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb, line 108
108:           def method_missing(*a, &b)
109:             @hpricot.attributes.send(*a, &b)
110:           end

[Source]

     # File lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb, line 103
103:           def stag_attributes_method
104:             # STag#attributes changed to STag#raw_attributes after Hpricot 0.5
105:             @hpricot.stag.respond_to?(:raw_attributes) ? :raw_attributes : :attributes
106:           end

[Validate]