diff options
Diffstat (limited to 'src/html')
| -rw-r--r-- | src/html/dom.nim | 16 | ||||
| -rw-r--r-- | src/html/script.nim | 3 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim index 759988eb..3c148952 100644 --- a/src/html/dom.nim +++ b/src/html/dom.nim @@ -1077,7 +1077,7 @@ func tagType*(element: Element): TagType = return element.tagTypeNoNS func findAttr(element: Element; qualifiedName: CAtom): int = - for i, attr in element.attrs.mpairs: + for i, attr in element.attrs.mypairs: if attr.qualifiedName == qualifiedName: return i return -1 @@ -1086,7 +1086,7 @@ func findAttr(element: Element; qualifiedName: StaticAtom): int = return element.findAttr(element.document.toAtom(qualifiedName)) func findAttrNS(element: Element; namespace, qualifiedName: CAtom): int = - for i, attr in element.attrs.mpairs: + for i, attr in element.attrs.mypairs: if attr.namespace == namespace and attr.qualifiedName == qualifiedName: return i return -1 @@ -1902,7 +1902,7 @@ func name(attr: Attr): CAtom {.jsfget.} = return attr.data.qualifiedName func findAttr(map: NamedNodeMap; dataIdx: int): int = - for i, attr in map.attrlist: + for i, attr in map.attrlist.mypairs: if attr.dataIdx == dataIdx: return i return -1 @@ -1932,7 +1932,7 @@ func attributes(element: Element): NamedNodeMap {.jsfget.} = if element.cachedAttributes != nil: return element.cachedAttributes element.cachedAttributes = NamedNodeMap(element: element) - for i, attr in element.attrs.mpairs: + for i, attr in element.attrs.mypairs: element.cachedAttributes.attrlist.add(Attr( internalDocument: element.document, index: -1, @@ -3182,7 +3182,7 @@ proc delAttr(element: Element; i: int; keep = false) = if map != nil: # delete from attrlist + adjust indices invalidated var j = -1 - for i, attr in map.attrlist.mpairs: + for i, attr in map.attrlist.mypairs: if attr.dataIdx == i: j = i elif attr.dataIdx > i: @@ -3583,7 +3583,7 @@ func cmpAttrName(a: AttrData; b: CAtom): int = # Returns the attr index if found, or the negation - 1 of an upper bound # (where a new attr with the passed name may be inserted). func findAttrOrNext(element: Element; qualName: CAtom): int = - for i, data in element.attrs.mpairs: + for i, data in element.attrs.mypairs: if data.qualifiedName == qualName: return i if int(data.qualifiedName) > int(qualName): @@ -4617,7 +4617,7 @@ func isEqualNode(node, other: Node): bool {.jsfunc.} = node.localName != other.localName or node.attrs.len != other.attrs.len: return false - for i, attr in node.attrs.mpairs: + for i, attr in node.attrs.mypairs: if not attr.equals(other.attrs[i]): return false elif node of Attr: @@ -4637,7 +4637,7 @@ func isEqualNode(node, other: Node): bool {.jsfunc.} = node of Comment and not (other of Comment): return false return CharacterData(node).data == CharacterData(other).data - for i, child in node.childList: + for i, child in node.childList.mypairs: if not child.isEqualNode(other.childList[i]): return false true diff --git a/src/html/script.nim b/src/html/script.nim index 2e009503..2d77c312 100644 --- a/src/html/script.nim +++ b/src/html/script.nim @@ -2,6 +2,7 @@ import monoucha/javascript import monoucha/quickjs import types/referrer import types/url +import utils/twtstr type ParserMetadata* = enum @@ -84,7 +85,7 @@ var errorImpl*: proc(ctx: JSContext; ss: varargs[string]) {.nimcall.} proc find*(moduleMap: ModuleMap; url: URL; moduleType: string): int = let surl = $url - for i, entry in moduleMap: + for i, entry in moduleMap.mypairs: if entry.key.moduleType == moduleType and entry.key.url == surl: return i return -1 |