mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 06:48:38 +09:00
Issue #1621 - Part 3: Use nsIAtom to change attirbute if possible.
We can replace old nsIEditor API with nsIAtom version. Ref: Bug 1324996
This commit is contained in:
parent
b6b2792a35
commit
ec1301a85d
7 changed files with 51 additions and 64 deletions
|
|
@ -2330,11 +2330,9 @@ EditorBase::CloneAttributes(Element* aDest,
|
|||
RefPtr<nsDOMAttributeMap> destAttributes = aDest->Attributes();
|
||||
while (RefPtr<Attr> attr = destAttributes->Item(0)) {
|
||||
if (destInBody) {
|
||||
RemoveAttribute(static_cast<nsIDOMElement*>(GetAsDOMNode(aDest)),
|
||||
attr->NodeName());
|
||||
RemoveAttribute(aDest, attr->NodeInfo()->NameAtom());
|
||||
} else {
|
||||
ErrorResult ignored;
|
||||
aDest->RemoveAttribute(attr->NodeName(), ignored);
|
||||
aDest->UnsetAttr(kNameSpaceID_None, attr->NodeInfo()->NameAtom(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2346,13 +2344,13 @@ EditorBase::CloneAttributes(Element* aDest,
|
|||
nsAutoString value;
|
||||
attr->GetValue(value);
|
||||
if (destInBody) {
|
||||
SetAttributeOrEquivalent(static_cast<nsIDOMElement*>(GetAsDOMNode(aDest)),
|
||||
attr->NodeName(), value, false);
|
||||
SetAttributeOrEquivalent(aDest, attr->NodeInfo()->NameAtom(), value,
|
||||
false);
|
||||
} else {
|
||||
// The element is not inserted in the document yet, we don't want to put
|
||||
// a transaction on the UndoStack
|
||||
SetAttributeOrEquivalent(static_cast<nsIDOMElement*>(GetAsDOMNode(aDest)),
|
||||
attr->NodeName(), value, true);
|
||||
SetAttributeOrEquivalent(aDest, attr->NodeInfo()->NameAtom(), value,
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue