Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[ZF-11835] Add conditional comments functionality to Zend_View_Helper_HeadMeta #624

Merged
merged 1 commit into from

2 participants

@adamlundrigan

SVN sync r24561 / r24562

@akrabat akrabat merged commit c8bde6a into from
@akrabat
Collaborator

Thanks Adam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 21, 2011
  1. @adamlundrigan
This page is out of date. Refresh to see the latest.
View
8 library/Zend/View/Helper/HeadMeta.php
@@ -371,6 +371,14 @@ public function itemToString(\stdClass $item)
$this->_escape($item->content),
$modifiersString
);
+
+ if (isset($item->modifiers['conditional'])
+ && !empty($item->modifiers['conditional'])
+ && is_string($item->modifiers['conditional']))
+ {
+ $meta = '<!--[if ' . $this->_escape($item->modifiers['conditional']) . ']>' . $meta . '<![endif]-->';
+ }
+
return $meta;
}
View
11 tests/Zend/View/Helper/HeadMetaTest.php
@@ -441,5 +441,16 @@ public function testCharset()
$view->plugin('headMeta')->toString());
}
+ /**
+ * @group ZF-11835
+ */
+ public function testConditional()
+ {
+ $html = $this->helper->appendHttpEquiv('foo', 'bar', array('conditional' => 'lt IE 7'))->toString();
+
+ $this->assertRegExp("|^<!--\[if lt IE 7\]>|", $html);
+ $this->assertRegExp("|<!\[endif\]-->$|", $html);
+ }
+
}
Something went wrong with that request. Please try again.