Skip to content
This repository

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

Merged
merged 1 commit into from over 2 years ago

2 participants

Adam Lundrigan Rob Allen
Adam Lundrigan

SVN sync r24561 / r24562

Rob Allen akrabat merged commit c8bde6a into from November 22, 2011
Rob Allen akrabat closed this November 22, 2011
Rob Allen
Collaborator

Thanks Adam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Nov 21, 2011
Adam Lundrigan [ZF-11835] Fixed: Add conditional comments functionality to Zend_View…
…_Helper_HeadMeta
c8bde6a
This page is out of date. Refresh to see the latest.
8  library/Zend/View/Helper/HeadMeta.php
@@ -371,6 +371,14 @@ public function itemToString(\stdClass $item)
371 371
             $this->_escape($item->content),
372 372
             $modifiersString
373 373
         );
  374
+
  375
+        if (isset($item->modifiers['conditional'])
  376
+            && !empty($item->modifiers['conditional'])
  377
+            && is_string($item->modifiers['conditional']))
  378
+        {
  379
+            $meta = '<!--[if ' . $this->_escape($item->modifiers['conditional']) . ']>' . $meta . '<![endif]-->';
  380
+        }
  381
+
374 382
         return $meta;
375 383
     }
376 384
 
11  tests/Zend/View/Helper/HeadMetaTest.php
@@ -441,5 +441,16 @@ public function testCharset()
441 441
 			$view->plugin('headMeta')->toString());
442 442
 	}
443 443
 
  444
+    /**
  445
+     * @group ZF-11835
  446
+     */
  447
+    public function testConditional() 
  448
+    {
  449
+        $html = $this->helper->appendHttpEquiv('foo', 'bar', array('conditional' => 'lt IE 7'))->toString();
  450
+        
  451
+        $this->assertRegExp("|^<!--\[if lt IE 7\]>|", $html);
  452
+        $this->assertRegExp("|<!\[endif\]-->$|", $html);
  453
+    }
  454
+
444 455
 }
445 456
 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.