Reviewers: felix8a,

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

Please review this at http://codereview.appspot.com/5697054/

Affected files:
  M     src/com/google/caja/demos/playground/client/ui/Example.java
  A     src/com/google/caja/demos/playground/examples/datepicker.html
  M     src/com/google/caja/plugin/bridal.js


Index: src/com/google/caja/plugin/bridal.js
===================================================================
--- src/com/google/caja/plugin/bridal.js        (revision 4784)
+++ src/com/google/caja/plugin/bridal.js        (working copy)
@@ -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);
     }

Index: src/com/google/caja/demos/playground/client/ui/Example.java
===================================================================
--- src/com/google/caja/demos/playground/client/ui/Example.java (revision 4784) +++ src/com/google/caja/demos/playground/client/ui/Example.java (working copy)
@@ -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");

Index: src/com/google/caja/demos/playground/examples/datepicker.html
===================================================================
--- src/com/google/caja/demos/playground/examples/datepicker.html (revision 0) +++ src/com/google/caja/demos/playground/examples/datepicker.html (revision 0)
@@ -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>


Reply via email to