diff --git a/docs/en/6-templates-context.md b/docs/en/6-templates-context.md index 0ca634cd..9d92e948 100644 --- a/docs/en/6-templates-context.md +++ b/docs/en/6-templates-context.md @@ -82,7 +82,10 @@ Result of BEMHTML templating: this.xmlEscape(str) ``` -Returns the passed `str` string with the following XML symbols escaped: `&`, `<`, `>`. +Returns the passed `str` string with the following XML symbols escaped: `&`, +`<`, `>`. Normaly, expected that `str` is a `String`. But if `str` is +`undefined`, `Null` or `NaN` an empty string returned. If `str` is of any other +type it will be casted to String before escaping. Usage example: @@ -114,7 +117,11 @@ Result of BEMHTML templating: this.attrEscape(str) ``` -Returns the passed `str` string with the following characters for XML and HTML attributes escaped: `"` and `&`. +Returns the passed `str` string with the following characters for XML and HTML +attributes escaped: `"` and `&`. Normaly, expected that `str` is a `String`. +But if `str` is `undefined`, `Null` or `NaN` type you get empty string. +If `str` is any other type you get native casting from it type to `String` +before escaping. #### jsAttrEscape @@ -126,7 +133,10 @@ Returns the passed `str` string with the following characters for XML and HTML a this.jsAttrEscape(str) ``` -Returns the passed `str` string with the following characters escaped: `'` and `&`. +Returns the passed `str` string with the following characters escaped: `'` and +`&`. Normaly, expected that `str` is a `String`. But if `str` is `undefined`, +`Null` or `NaN` type you get empty string. If `str` is any other type you get +native casting from it type to `String` before escaping. By default, input data from the [`js`](4-data.md#js) field and data from the [`js`](5-templates-syntax.md#js) mode are escaped using this function. diff --git a/docs/ru/6-templates-context.md b/docs/ru/6-templates-context.md index da7891cb..028efa52 100644 --- a/docs/ru/6-templates-context.md +++ b/docs/ru/6-templates-context.md @@ -80,7 +80,10 @@ block('company').attr()(function() { this.xmlEscape(str) ``` -Возвращает переданную строку `str` с заэкранированными символами XML: `&`, `<`, `>`. +Возвращает переданную строку `str` с заэкранированными символами XML: `&`, `<`, +`>`. Ожидается, что `str` это строка. Но если `str` это `undefined`, +`Null` или `NaN`, то функция возвратит пустую строку. Если `str` любого другого +типа, то перед экранированием этот тип будет приведен к строке. Пример использования: @@ -112,7 +115,10 @@ block('button').def()(function() { this.attrEscape(str) ``` -Возвращает переданную строку `str` с заэкранированными символами XML- и HTML-атрибутов: `"` и `&`. +Возвращает переданную строку `str` с заэкранированными символами XML- и +HTML-атрибутов: `"` и `&`. Ожидается, что `str` это строка. Но если `str` это +`undefined`, `Null` или `NaN`, то функция возвратит пустую строку. Если `str` +любого другого типа, то перед экранированием этот тип будет приведен к строке. #### jsAttrEscape @@ -125,6 +131,9 @@ this.jsAttrEscape(str) ``` Возвращает переданную строку `str` с заэкранированными символами: `'` и `&`. +Ожидается, что `str` это строка. Но если `str` это `undefined`, `Null` или +`NaN`, то функция возвратит пустую строку. Если `str` любого другого типа, то +перед экранированием этот тип будет приведен к строке. По умолчанию входные данные из поля [`js`](4-data.md#js) и данные из режима [`js`](5-templates-syntax.md#js) экранируются этой функцией.