Anduin Xue
Anduin Xue
 666
哈哈 :D
Don't forget here: https://github.com/microsoft/NugetNinja/blob/main/.github/workflows/build.yml
Thanks for your contribution! Will resolve.
第三点我试了下,基本上是不可行的。 因为HTag this[string tagName]的返回值表示一个标签,而不是标签的集合。(默认是第一个) 如果按照上面的改法,必须改成返回一个集合。那么就会和老版本不向下兼容了。这会很麻烦…… 所以只有在额外传递索引后,仍然返回标签,但是不再返回第一个。
关于第二点,我试了一下。 如果HTag this[string tagName]填错,结果会返回null。我认为这是符合期待的。使用者能够明白这里索引失败了。 如果HTag this[string tagName, int tagIndex]越界,会抛出异常: >System.ArgumentOutOfRangeException: 'Index was out of range. 我认为这也是符合期待的。 如果你建议提供更详细的错误信息,我看了看好像不是很好改。你可以试试。如果有相关的PR,我会同意。
关于第一点,我也仔细想了一下。 Children是能够保证一致性的一个值,而且性能不错。一般它不会太大,所以不会有太大问题。 其实目前实际使用中,最需要提升性能的,是它的AllUnder方法(前序遍历递归获取整个元素下所有子元素的集合),因为这个方法没有任何索引,每次调用时都会递归整个HDoc。 我最近计划给AllUnder创建索引。Children并没有形成性能瓶颈。建立索引也行,但是一般一个标签下平级标签一般不会太多,所以性能提升应该不明显,反而会影响一致性。 或者干脆放弃List,直接用Dictionary来代替它,应该可行。 这里我暂时打算维持现有代码不动(HSharp这个项目是我三年前左右开发的,今天已经很难读懂当时我的一些想法了……)。 如果你愿意贡献,欢迎提交PR。我会同意。
Ok. Will investigate.
It seems that it was because the long script tag which caused the regex stop working. We will try this solution to resolve this: * Remove all script tags in...
 It seems that those tags in scripts which caused the code stop working.