Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding domReady to prototype

  • Loading branch information...
commit 55eafaf112b422419482ccd3210390f575183837 1 parent 8cc5990
@markstory markstory authored
View
3  cake/libs/view/helpers/prototype_engine.php
@@ -88,7 +88,8 @@ function event($type, $callback, $options = array()) {
* @return string completed domReady method
**/
function domReady($functionBody) {
-
+ $this->selection = 'document';
+ return $this->event('dom:loaded', $functionBody, array('stop' => false));
}
/**
* Create an iteration over the current selection result.
View
4 cake/tests/cases/libs/view/helpers/prototype_engine.test.php
@@ -94,7 +94,9 @@ function testEvent() {
* @return void
**/
function testDomReady() {
-
+ $result = $this->Proto->domReady('foo.name = "bar";');
+ $expected = 'document.observe("dom:loaded", function (event) {foo.name = "bar";});';
+ $this->assertEqual($result, $expected);
}
/**
* test Each method
Please sign in to comment.
Something went wrong with that request. Please try again.