-
-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename Html:add() to Html:addHtml() #111
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -362,17 +362,39 @@ public function getText() | |
} | ||
|
||
|
||
/** | ||
* @deprecated | ||
*/ | ||
public function add($child) | ||
{ | ||
trigger_error('Method Nette\Utils\Html::add() is deprecated, use addHtml() or addText() instead.', E_USER_DEPRECATED); | ||
return $this->addHtml($child); | ||
} | ||
|
||
|
||
/** | ||
* Adds new element's child. | ||
* @param Html|string Html node or raw HTML string | ||
* @return self | ||
*/ | ||
public function add($child) | ||
public function addHtml($child) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe only allow Html instance? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure that's a good idea. How would you provide custom HTML as string? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You would need to wrap it as an Html instance. But I think that the current solution is better. |
||
{ | ||
return $this->insert(NULL, $child); | ||
} | ||
|
||
|
||
/** | ||
* Appends plain-text string to element content. | ||
* @param string plain-text string | ||
* @return self | ||
*/ | ||
public function addText($text) | ||
{ | ||
$text = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8'); | ||
return $this->insert(NULL, $text); | ||
} | ||
|
||
|
||
/** | ||
* Creates and adds a new Html child. | ||
* @param string elements's name | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how is the add() short. What about to allow HTML instance and strings consider as a text? Not sure how to warn about change.