Revision: 4786
Author:   jasvir
Date:     Fri Feb 24 13:22:28 2012
Log:      Make datepicker from jQueryUI
http://codereview.appspot.com/5697054

Trivial fix to bridal that makes datepicker from jQueryUI work.
Also requires an upstream patch to jQueryUI to avoid the try/catch masking.

[email protected]

http://code.google.com/p/google-caja/source/detail?r=4786

Added:
 /trunk/src/com/google/caja/demos/playground/examples/datepicker.html
Modified:
 /trunk/src/com/google/caja/demos/playground/client/ui/Example.java
 /trunk/src/com/google/caja/plugin/bridal.js

=======================================
--- /dev/null
+++ /trunk/src/com/google/caja/demos/playground/examples/datepicker.html Fri Feb 24 13:22:28 2012
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+       <meta charset="utf-8">
+       <title>jQuery UI Datepicker - Default functionality</title>
+ <link rel="stylesheet" href="http://jqueryui.com/themes/base/jquery.ui.all.css";> + <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js";></script>
+       <script src="http://jqueryui.com/ui/jquery.ui.core.js";></script>
+       <script src="http://jqueryui.com/ui/jquery.ui.widget.js";></script>
+ <!-- TODO(jasvir): Switch back to real date picker when datepicker fix is in upstream -->
+       <script src="http://www.thinkfu.com/jquery.ui.datepicker.js";></script>
+       <link rel="stylesheet" href="http://jqueryui.com/demos/demos.css";>
+       <script>
+       $(function() {
+               $( "#datepicker" ).datepicker();
+       });
+       </script>
+</head>
+<body>
+
+<div class="demo">
+
+<p>Date: <input type="text" id="datepicker"></p>
+
+</div><!-- End demo -->
+
+
+
+<div class="demo-description">
+<ul>
+<li>The datepicker is tied to a standard form input field.
+<li>Focus on the input (click, or use the tab key) to open an interactive calendar in a small overlay. +<li>Choose a date, click elsewhere on the page (blur the input), or hit the Esc key to close.
+<li>If a date is chosen, feedback is shown as the input's value.
+</ul>
+</div><!-- End demo-description -->
+
+</body>
+</html>
=======================================
--- /trunk/src/com/google/caja/demos/playground/client/ui/Example.java Wed Sep 14 14:31:31 2011 +++ /trunk/src/com/google/caja/demos/playground/client/ui/Example.java Fri Feb 24 13:22:28 2012
@@ -37,6 +37,10 @@
   LIFE("examples/cajalife.html",
       Type.APPS, "Game of Life"),

+  // JQuery and JQueryUI
+  DATEPICKER("examples/datepicker.html",
+      Type.JQUERY, "Date Picker"),
+
   // Benchmarks
   COMBINED("sunspider/combined.html", Type.BENCHMARK, "combined"),
   THREED_CUBE("sunspider/3d-cube.html", Type.BENCHMARK, "3d-cube"),
@@ -97,6 +101,7 @@
     WEB("Web pages"),
     APPS("Applications"),
     ATTACK("Attacks"),
+    JQUERY("jQuery"),
     BENCHMARK("Benchmarks"),
     TAMING("Taming");

=======================================
--- /trunk/src/com/google/caja/plugin/bridal.js Fri Jul 29 11:14:40 2011
+++ /trunk/src/com/google/caja/plugin/bridal.js Fri Feb 24 13:22:28 2012
@@ -703,7 +703,7 @@
    * such as ":first-child".
    */
   function getComputedStyle(element, pseudoElement) {
-    if (element.currentStyle && pseudoElement === void 0) {
+ if (makeDOMAccessible(element).currentStyle && pseudoElement === void 0) {
       return makeDOMAccessible(element.currentStyle);
     }

Reply via email to