You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to have a function similar to Vec::retain_mut to remove or modify the attributes of an element while iterating over them.
This is currently doable, but involves iterating over the attributes, collecting and cloning their names, potentially cloning the new value, and searching the attribute in the attribute list every time we want to remove or modify an attribute.
The proposed function would make this much more efficient and simpler to implement.
I guess this function would have to be available on StartTag and on Element. I am not quite sure about the naming, but I'd be willing to contribute this.
The text was updated successfully, but these errors were encountered:
Since we have to reset StartTag::raw if any attribute is modified, we cannot just pass a mutable reference to an Attribute.
We could either pass a wrapper to an Attribute, or return an enum in our callback (Noop, Remove, Replace(new_value))
Each solution has some drawback. The solution with the wrapper is more complex, while the solution with the return value requires the new value to be owned. I personally prefer the second solution.
I would like to have a function similar to Vec::retain_mut to remove or modify the attributes of an element while iterating over them.
This is currently doable, but involves iterating over the attributes, collecting and cloning their names, potentially cloning the new value, and searching the attribute in the attribute list every time we want to remove or modify an attribute.
The proposed function would make this much more efficient and simpler to implement.
I guess this function would have to be available on StartTag and on Element. I am not quite sure about the naming, but I'd be willing to contribute this.
The text was updated successfully, but these errors were encountered: