зеркало из https://github.com/mozilla/pjs.git
Bug 134295: Make position() work together with xsl:sort again. This will put back some problems with attribute-nodes, but those problems should be much less common then the current situation.
r=peterv sr=jst
This commit is contained in:
Родитель
277cd8403f
Коммит
95eff9cc70
|
@ -319,14 +319,17 @@ void NodeSet::reverse()
|
||||||
* @param aNode the Node to get the index for
|
* @param aNode the Node to get the index for
|
||||||
* @return index of specified node or -1 if the node does not exist
|
* @return index of specified node or -1 if the node does not exist
|
||||||
*/
|
*/
|
||||||
MBool NodeSet::indexOf(Node* aNode) const
|
int NodeSet::indexOf(Node* aNode) const
|
||||||
{
|
{
|
||||||
// XXX evaluate cost of this
|
// XXX this doesn't fully work since attribute-nodes are broken
|
||||||
// Workaround to fix the fact that attributes can't be
|
// and can't be pointer-compared. However it's the best we can
|
||||||
// pointer-compared
|
// do for now.
|
||||||
MBool nonDup;
|
int i;
|
||||||
int pos = findPosition(aNode, 0, mElementCount - 1, nonDup);
|
for (i = 0; i < mElementCount; ++i) {
|
||||||
return nonDup ? -1 : pos;
|
if (mElements[i] == aNode)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Загрузка…
Ссылка в новой задаче