Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/externals/javelin/docs/concepts/behaviors.diviner
Show First 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | - DOM Level 0 events have a host of issues in a complex application | ||||
environment. | environment. | ||||
- The JS global namespace becomes polluted with application glue functions. | - The JS global namespace becomes polluted with application glue functions. | ||||
- The server and client are tightly and relatively arbitrarily coupled, since | - The server and client are tightly and relatively arbitrarily coupled, since | ||||
many of these handlers called multiple functions or had logic in the | many of these handlers called multiple functions or had logic in the | ||||
strings. There is no structure to the coupling, so many callers relied on | strings. There is no structure to the coupling, so many callers relied on | ||||
the full power of arbitrary JS execution. | the full power of arbitrary JS execution. | ||||
- It's utterly hideous. | - It's utterly hideous. | ||||
In 2007/2008, we introduced @{function@libphutil:jsprintf} and a function called | In 2007/2008, we introduced @{function@arcanist:jsprintf} and a function called | ||||
onloadRegister() to solve some of the obvious problems: | onloadRegister() to solve some of the obvious problems: | ||||
lang=php | lang=php | ||||
onloadRegister('win_a_hog(%s);', $hog_name); | onloadRegister('win_a_hog(%s);', $hog_name); | ||||
This registers the snippet for invocation after DOMContentReady fires. This API | This registers the snippet for invocation after DOMContentReady fires. This API | ||||
makes escaping manageable, and was combined with recommendations to structure | makes escaping manageable, and was combined with recommendations to structure | ||||
code like this in order to address some of the other problems: | code like this in order to address some of the other problems: | ||||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |