wikiparser-node 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -304,7 +304,14 @@ class AstElement extends node_1.AstNode {
304
304
  const { childNodes, fixed } = parentNode, protectedIndices = parentNode.getAttribute('protectedChildren').applyTo(childNodes);
305
305
  return fixed || protectedIndices.includes(childNodes.indexOf(this));
306
306
  }
307
- /** @private */
307
+ /**
308
+ * 检查是否符合属性选择器
309
+ * @param key 属性键
310
+ * @param equal 比较符
311
+ * @param val 属性值
312
+ * @param i 是否对大小写不敏感
313
+ * @throws `RangeError` 复杂属性不能用于选择器
314
+ */
308
315
  #matchesAttr(key, equal, val = '', i) {
309
316
  const isAttr = typeof this.hasAttr === 'function' && typeof this.getAttr === 'function';
310
317
  if (!(key in this) && (!isAttr || !this.hasAttr(key))) {
@@ -315,9 +322,11 @@ class AstElement extends node_1.AstNode {
315
322
  }
316
323
  const v = toCase(val, i);
317
324
  let thisVal = this.getAttribute(key);
318
- if (isAttr && thisVal === undefined) {
325
+ if (isAttr) {
319
326
  const attr = this.getAttr(key);
320
- thisVal = attr === true ? '' : attr;
327
+ if (attr !== undefined) {
328
+ thisVal = attr === true ? '' : attr;
329
+ }
321
330
  }
322
331
  if (thisVal instanceof RegExp) {
323
332
  thisVal = thisVal.source;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wikiparser-node",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "A Node.js parser for MediaWiki markup with AST",
5
5
  "keywords": [
6
6
  "mediawiki",