@@ -1211,19 +1211,19 @@ follow the following steps:
121112114. Let <var> insiders</var> be the subset of <var> candidates</var> items
12121212 whose [=DOM anchor=] are descendants of <var> searchOrigin</var>
12131213 and whose <a>boundary box</a> 's
1214- * top edge is below the top edge of <var> insideArea</var> if <var> D </var> is <code> down</code>
1215- * bottom edge is above the bottom edge of <var> insideArea</var> if <var> D </var> is <code> up</code>
1216- * right edge is left of the right edge of <var> insideArea</var> if <var> D </var> is <code> left</code>
1217- * left edge is right of the left edge of <var> insideArea</var> if <var> D </var> is <code> right</code>
1214+ * top edge is below the top edge of <var> insideArea</var> if <var> dir </var> is <code> down</code>
1215+ * bottom edge is above the bottom edge of <var> insideArea</var> if <var> dir </var> is <code> up</code>
1216+ * right edge is left of the right edge of <var> insideArea</var> if <var> dir </var> is <code> left</code>
1217+ * left edge is right of the left edge of <var> insideArea</var> if <var> dir </var> is <code> right</code>
12181218
12191219 Note: this sub-setting is necessary to avoid going in the opposite direction than the one requested.
122012205.
12211221 * If <var> insiders</var> is non empty
12221222 1. Let <var> closest subset</var> be the subset of <var> insiders</var> whose <a>boundary box</a> 's
1223- * top edge is closest to the top edge of <var> insideArea</var> if <var> D </var> is <code> down</code>
1224- * bottom edge is closest to the bottom edge of <var> insideArea</var> if <var> D </var> is <code> up</code>
1225- * right edge is closest to the right edge of <var> insideArea</var> if <var> D </var> is <code> left</code>
1226- * left edge is closest to the left edge of <var> insideArea</var> if <var> D </var> is <code> right</code>
1223+ * top edge is closest to the top edge of <var> insideArea</var> if <var> dir </var> is <code> down</code>
1224+ * bottom edge is closest to the bottom edge of <var> insideArea</var> if <var> dir </var> is <code> up</code>
1225+ * right edge is closest to the right edge of <var> insideArea</var> if <var> dir </var> is <code> left</code>
1226+ * left edge is closest to the left edge of <var> insideArea</var> if <var> dir </var> is <code> right</code>
12271227 2. If <var> closest subset</var> contains a single item,
12281228 return that item,
12291229 else return the first item of <var> closest subset</var> in document order,
@@ -1236,11 +1236,13 @@ follow the following steps:
12361236 1. Set <var> candidates</var> be the subset of its items
12371237 whose <a>boundary box</a> 's geometric center is within the closed half plane
12381238 whose boundary goes through the geometric center of the <var> searchOrigin</var>
1239- and is perpendicular to <var> D </var> .
1239+ and is perpendicular to <var> dir </var> .
12401240 2. For each <var> candidate</var> in <var> candidates</var> ,
1241- find the points <var> P1</var> inside the <a>boundary box</a> of <var> searchOrigin</var>
1242- and <var> P2</var> inside the <a>boundary box</a> of <var> candidate</var>
1243- that minimize the <var> distance</var> between these two points,
1241+ 1. If the <var> searchOrigin</var> is an element, then find the points <var> P1</var> inside the <a>boundary box</a>
1242+ of <var> searchOrigin</var> and P2 inside the boundary box of <var> candidate</var> .
1243+ 2. Else if the <var> searchOrigin</var> is a point, then let the point <var> P1</var> be the <var> searchOrigin</var>
1244+ and find the point <var> P2</var> inside the <a>boundary box</a> .
1245+ 3. Select the <var> P1</var> and <var> P2</var> that make the smallest <var> distance</var> between those two points,
12441246 when <var> distance</var> is defined as follows:
12451247
12461248 <dl>
0 commit comments