Remove an unnecessary loop
The unprotected_ids function returns all unprotected ids and removeUnreferencedIDs removes all of them that does not appear in the return value of findReferencedElements. On closer observation it turns out that removeUnreferencedIDs cannot cause nodes/IDs to become unprotected nor unreferenced (as it only remove the "id" attribute, not the node). With this in mind, we can just remove the loop and save a call to all of these functions. Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
5360db86d9
commit
0776d32179
1 changed files with 3 additions and 5 deletions
|
|
@ -3471,11 +3471,9 @@ def scourString(in_string, options=None):
|
|||
_num_elements_removed += 1
|
||||
|
||||
if options.strip_ids:
|
||||
bContinueLooping = True
|
||||
while bContinueLooping:
|
||||
identifiedElements = unprotected_ids(doc, options)
|
||||
referencedIDs = findReferencedElements(doc.documentElement)
|
||||
bContinueLooping = (removeUnreferencedIDs(referencedIDs, identifiedElements) > 0)
|
||||
referencedIDs = findReferencedElements(doc.documentElement)
|
||||
identifiedElements = unprotected_ids(doc, options)
|
||||
removeUnreferencedIDs(referencedIDs, identifiedElements)
|
||||
|
||||
while removeDuplicateGradientStops(doc) > 0:
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue