summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAsmir Mustafic <[email protected]>2014-06-30 12:10:44 +0200
committerAsmir Mustafic <[email protected]>2014-06-30 12:10:44 +0200
commit7c176539423d7e1acd0e5191855bdee8f0ed1a37 (patch)
tree140b75c1a43291f72972fb4ac4c2b4c90ad62113 /src
parent45e0f801d896258022c6a70a7738b991cb19aafe (diff)
Fiexed a issue when xmlNamespaces = true
Diffstat (limited to 'src')
-rw-r--r--src/HTML5/Parser/DOMTreeBuilder.php20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/HTML5/Parser/DOMTreeBuilder.php b/src/HTML5/Parser/DOMTreeBuilder.php
index b9e587f..d2c8020 100644
--- a/src/HTML5/Parser/DOMTreeBuilder.php
+++ b/src/HTML5/Parser/DOMTreeBuilder.php
@@ -340,7 +340,9 @@ class DOMTreeBuilder implements EventHandler
$this->pushes[spl_object_hash($ele)] = array($pushes, $ele);
// SEE https://github.com/facebook/hhvm/issues/2962
- $ele->setAttribute('html5-php-fake-id-attribute', spl_object_hash($ele));
+ if (defined('HHVM_VERSION')) {
+ $ele->setAttribute('html5-php-fake-id-attribute', spl_object_hash($ele));
+ }
}
foreach ($attributes as $aName => $aVal) {
@@ -431,6 +433,13 @@ class DOMTreeBuilder implements EventHandler
$lname = Elements::normalizeSvgElement($lname);
}
+ // See https://github.com/facebook/hhvm/issues/2962
+ if (defined('HHVM_VERSION') && ($cid = $this->current->getAttribute('html5-php-fake-id-attribute'))) {
+ $this->current->removeAttribute('html5-php-fake-id-attribute');
+ } else {
+ $cid = spl_object_hash($this->current);
+ }
+
// XXX: Not sure whether we need this anymore.
// if ($name != $lname) {
// return $this->quirksTreeResolver($lname);
@@ -442,17 +451,10 @@ class DOMTreeBuilder implements EventHandler
return;
}
- // https://github.com/facebook/hhvm/issues/2962
- if ($cid = $this->current->getAttribute('html5-php-fake-id-attribute')) {
- $this->current->removeAttribute('html5-php-fake-id-attribute');
- } else {
- $cid = spl_object_hash($this->current);
- }
-
// remove the namespaced definded by current node
if (isset($this->pushes[$cid])) {
for ($i = 0; $i < $this->pushes[$cid][0]; $i ++) {
- $extr = array_shift($this->nsStack);
+ array_shift($this->nsStack);
}
unset($this->pushes[$cid]);
}