File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 1515//
1616// You should have received a copy of the GNU Affero General Public License
1717// along with this program. If not, see <https://www.gnu.org/licenses/>.
18-
1918const parser = @import ("../netsurf.zig" );
2019
2120const Node = @import ("node.zig" ).Node ;
@@ -47,7 +46,14 @@ pub const Attr = struct {
4746 }
4847
4948 pub fn set_value (self : * parser.Attribute , v : []const u8 ) ! ? []const u8 {
50- try parser .attributeSetValue (self , v );
49+ if (try parser .attributeGetOwnerElement (self )) | el | {
50+ // if possible, go through the element, as that triggers a
51+ // DOMAttrModified event (which MutationObserver cares about)
52+ const name = try parser .attributeGetName (self );
53+ try parser .elementSetAttribute (el , name , v );
54+ } else {
55+ try parser .attributeSetValue (self , v );
56+ }
5157 return v ;
5258 }
5359
Original file line number Diff line number Diff line change @@ -134,5 +134,7 @@ test "Browser.DOM.NamedNodeMap" {
134134 .{ "a['id'].name" , "id" },
135135 .{ "a['id'].value" , "content" },
136136 .{ "a['other']" , "undefined" },
137+ .{ "a[0].value = 'abc123'" , null },
138+ .{ "a[0].value" , "abc123" },
137139 }, .{});
138140}
You can’t perform that action at this time.
0 commit comments