Ran
|
Files
154
|
Run time
8s
|
Badge
Embed ▾
README BADGES
|
push
travis-ci
<a href="https://github.com/wikimedia/parsoid/commit/<a class=hub.com/wikimedia/parsoid/commit/1641a20b0b37312e3e5fcf6e83e024a8ce3019f8">1641a20b0<a href="https://github.com/wikimedia/parsoid/commit/1641a20b0b37312e3e5fcf6e83e024a8ce3019f8">">Use DOMDataUtils::getNodeData in MachineLanguageGuesser PHP lacks a general-purpose hash table which can use arbitrary objects (DOM nodes in this case) as keys. We&#39;ve tried using expando properties directly on the PHP objects before, and found that the properties spontaneously disappear when the original PHP object goes out of scope and later a new PHP wrapper is created from scratch to wrap the same underlying C object. I had been using Node::getNodePath() to give a string key which can be used in the table, but T241146 shows that this can break: once LanguageConverter has started to insert new &lt;span&gt; tags in Text nodes for round-trip information, the NodePath() of subsequent &lt;span&gt; tags changes, which then causes crashes when the keys corresponding to these aren&#39;t found. Use the existing DOMDataUtils::getNodeData() framework to associate information with Elements instead. Since this only works on elements, not Nodes, turn the traversal inside-out a little bit so we manually compute and sum the results for Text node children of an Element. In the process, simplify the complicated &quot;shared array&quot; logic of the original Parsoid/JS version, since PHP gives us shared copy-on-write arrays &quot;for free&quot;. Unfortunately, now that we&#39;re using the getNodeData() framework we need to move language conversion earlier in the DOMPostProcessor pipeline in order to ensure that the data-object-ids are properly cleaned up and don&#39;t leak into the output. Uses the refactored Parsoid::pb2pb from I</a><a class="double-link" href="https://github.com/wikimedia/parsoid/commit/<a class="double-link" href="https://github.com/wikimedia/parsoid/commit/4a5918d7cdf6e1abb3c806b07464bda8f6ae82b3">4a5918d7c</a>">4a5918d7c</a><a href="https://github.com/wikimedia/parsoid/commit/1641a20b0b37312e3e5fcf6e83e024a8ce3019f8"> to facilitate loading/storing the data attributes. Typically, the `data-parsoid` attribute isn't supplied ... (continued)
9663 of 12132 branches covered (79.65%)
15153 of 17854 relevant lines covered (84.87%)
34469.89 hits per line
Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line | Branch Hits | Branch Misses |
---|