- Screen name: jeremy.chone
jeremy.chone's Profile
6 Posts
8 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- 13-Apr-2011 01:12 PM
- Forum: Developing jQuery Core
Load the following page in Firefox (3.6+ or 4.0) and Chrome/SafariIn Webkit browsers, the $box.position() take in account the css transform translate() operation, however in Firefox when we call after the css translate, the $box.position() return the same values than before the translate (even if the $box has been successfully translated)Here is the short code to illustrate this issue (but do a view source on the above URL to see the full code)- //#box div is with css {position:absolute;top: 100px; left: 100px}
- var $box = $("#box");
- // as expected, in both browsers, $box.position() is {top:100,left:100}
- //we do the css translate
- var transformProp = ($.browser.webkit)?"-webkit-transform":"-moz-transform";
- $box.css(transformProp,"translate(150px,150px)");
- // Webkit browsers $box.position() is {top:250,left:250} (as expected)
- // but, on firefox, $box.position() is still {top:100,left:100} ;(
Note: There were some confusions in the comments about some css hooks code, but, this has nothing to do with CSS Hooks, in both case, WebKit and Firefox, the box gets translated correctly, just that on Firefox the $.position() does not take in account the translation operation. I fixed the code and created a sample HTML page (link above) that shows the issue.Any help greatly appreciated, the work around is pretty ugly for this one.- 04-Apr-2011 08:00 PM
- Forum: Using jQuery
- // Assuming absolute positioning
- $myDiv.position({left:100,top:100});
- // assuming we have a "transform" jQuery.CSSHooks for MozTranform and WebkitTransform
- $myDiv.css("transform","translate(50px, 50px)");
- var newLeft = $myDiv.position().left;
- // on Firefox 3.6.15
- // newLeft == 100
- // on Webkit based browsers
- // newLeft == 150
Not sure which one is the right behavior (I prefer the Webkit result), but would be great to have jQuery normalizing it. Doing this in the application is very ineffective.- 06-Sep-2010 01:50 PM
- Forum: Using jQuery
$(document).bind("touchstart touchmove touchend",function(event){
debug("touch event " + event.type + " touches: " + event.touches);
});
// doing this will pretty will print ".... touches: undefined"
Workaround: Luckily, jQuery keep the originalEvent handy (thank you!)
debug("touch event " + event.type + " touches: " + event.originalEvent.touches);
- 18-Jan-2010 08:23 PM
- Forum: Developing jQuery Core
http://www.bitsandpix.com/entry/jquery-bubblebind-jquery-plugin-to-bind-bubbling-events/
$("#parentDiv").bubbleBind("span","click",function(){ alert("you clicked on an span tag: " + $(this).html()); });I developed a dead-trivial jQuery plugin to make binding of bubbling event as similar as possible to the traditional jQuery direct binding.
While doing a jQuery.bind and jQuery.is is not hard it itself, the current API tends to make the default bind to be direct which could have serious performance consequences in some circumstances.
I think that having something similar to bubbleBind (better written and more complete) at the core will entice developers to think about their event binding architecture and write better performing jQuery Web application. And it goes well with the "write less, do more"
This is just a thought, not even an opinion.
Best,
- Hi,
Any thought has been given on adding filter on event. For example
a) Called when enter will be pressed.
$("#myTextInputField").bind("keypress:enter",function(e){...});
b) Called when a digit is pressed.
$("#myTextInputField").bind("keypress:0-9",function(e){...});
c) Called when mouseenter with the key shift is pressed
$("#myTextInputField").bind("mouseenter:shift",function(e){...});
d) Called when mouseenter with the keys shift and ctrl are pressed
$("#myTextInputField").bind("mouseenter:shift&ctrl",function(e){...});
I am not sure this would be the right notation, but it will definitely
simplify some code and make it less error prone.
Jeremy,
--- 28-Nov-2009 02:41 PM
- Forum: Developing jQuery Core
Hi,
I am hitting something quite strange. When I try to add a comment
"<!-- comment -->" to a <tr> element, it either remove all the <td>
tags (if the comment is at the beginning of the string) or get ignored
if the comment is at the end.
So, let's say I have a simple table
<table>
<tr id="myTr">
<td>cell1</td>
<td>cell2</td>
</tr>
</table>
Doing: $("#myTr").html("<!-- refreshed row --><td>newCell1</
td><td>newCell2</td>");
Will result in just "newCellnewCell2" inside the <tr>. All tds
disappeared and the guilty comment went away as well.
Using innerHTML seems to work better, but I would prefer standardizing
on $.html(), $.append(), ... regardless of the container tag.
Thank you for any help. I run Firefox 3.0.1 on Win7/64bit.
Jeremy,
--- «Prev
- Next »
Moderate user : jeremy.chone
© 2012 jQuery Foundation
Sponsored by
and others.


