Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/zendframework/zendframework#6634-allow-crossorig…
Browse files Browse the repository at this point in the history
…in-headscript-attribute' into develop

Close zendframework/zendframework#6634
Forward port zendframework/zendframework#6634
  • Loading branch information
Ocramius committed Dec 11, 2014
3 parents 3bf5c92 + 859c3bb + 7cec5b3 commit 328eff7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Helper/HeadScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@ class HeadScript extends Placeholder\Container\AbstractStandalone
*
* @var array
*/
protected $optionalAttributes = array('charset', 'defer', 'language', 'src');
protected $optionalAttributes = array(
'charset',
'crossorigin',
'defer',
'language',
'src',
);

/**
* Required attributes for script tag
Expand Down
13 changes: 13 additions & 0 deletions test/Helper/HeadScriptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,4 +458,17 @@ public function testNoEscapeTrue()
$this->assertNotContains('//<!--', $test);
$this->assertNotContains('//-->', $test);
}

/**
* @group 6634
*/
public function testSupportsCrossOriginAttribute()
{
$this->helper->__invoke()->appendScript(
'// some script' . PHP_EOL, 'text/javascript', array('crossorigin' => true)
);
$test = $this->helper->__invoke()->toString();

$this->assertContains('crossorigin="', $test);
}
}

0 comments on commit 328eff7

Please sign in to comment.