Skip to content

Commit 4965ce3

Browse files
committed
Make JsStrings self-aware
1 parent 7cccdf1 commit 4965ce3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Illuminate/Support/JsString.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ public function __toString()
8585
*/
8686
protected function convertDataToJavaScriptExpression($data, $flags = 0, $depth = 512)
8787
{
88+
if ($data instanceof self) {
89+
return $data->toHtml();
90+
}
91+
8892
$json = $this->jsonEncode($data, $flags, $depth);
8993

9094
if (is_string($data)) {

0 commit comments

Comments
 (0)