39 | | void operation(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString str); |
40 | | }}} |
41 | | |
42 | | [TreatNullAs=NullString] indicates that if JavaScript null is passed to the attribute/parameter, |
43 | | then it is converted to the null string in WebKit, for which String::IsEmpty() and String::IsNull() will return true. |
44 | | Without [TreatNullAs=NullString], JavaScript null is converted to a string "null" in WebKit. |
| 39 | void func(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString str); |
| 40 | }}} |
| 41 | |
| 42 | [TreatNullAs=NullString] indicates that if a JavaScript null is passed to the attribute/parameter, |
| 43 | then it is converted to a null string in WebKit, for which String::IsEmpty() and String::IsNull() will return true. |
| 44 | Without [TreatNullAs=NullString], a JavaScript null is converted to a string "null" in WebKit. |
49 | | [TreatUndefinedAs=NullString] indicates that if JavaScript undefined is passed to the attribute/parameter, |
50 | | then it is converted to the null string in WebKit, for which IsEmpty() and IsNull() will return true. |
51 | | Without [TreatUndefinedAs=NullString], JavaScript undefined is converted to a string "undefined" in WebKit. |
| 49 | [TreatUndefinedAs=NullString] indicates that if a JavaScript undefined is passed to the attribute/parameter, |
| 50 | then it is converted to a null string in WebKit, for which IsEmpty() and IsNull() will return true. |
| 51 | Without [TreatUndefinedAs=NullString], a JavaScript undefined is converted to a string "undefined" in WebKit. |
59 | | |
60 | | === * [TreatReturnedNullStringAs](o,a,p) === |
| 59 | === * [TreatReturnedNullStringAs](o,a) === |
| 60 | |
| 61 | The possible usage is [TreatReturnedNullStringAs=Null], [TreatReturnedNullStringAs=Undefined] or [TreatReturnedNullStringAs=False]. |
| 62 | They can be specified on DOMString attributes or operations which return a DOMString value, like this: |
| 63 | |
| 64 | {{{ |
| 65 | attribute [TreatReturnedNullStringAs=Null] DOMString str; |
| 66 | [TreatReturnedNullStringAs=Undefined] DOMString func(); |
| 67 | }}} |
| 68 | |
| 69 | [TreatReturnedNullStringAs=Null] indicates that if the returned string is a null string in WebKit, the returned value is converted to a JavaScript null. |
| 70 | |
| 71 | [TreatReturnedNullStringAs=Undefined] indicates that if the returned string is a null string in WebKit, the returned value is converted to a JavaScript undefined. |
| 72 | |
| 73 | [TreatReturnedNullStringAs=False] indicates that if the returned string is a null string in WebKit, the returned value is converted to a JavaScript false. |
| 74 | |
| 75 | Without [TreatReturnedNullStringAs=...], if the returned string is a null string in WebKit, the returned value becomes a JavaScript empty string ''. Note that what should be specified depends on the spec of each attribute or operation. |