[jQuery] Re: :first-line workaround?

2008-03-03 Thread bweaverusenet

Hi, Karl. If I understand Widon't correctly, it simply replaces the
space before the last word in an element with a non-breaking space.
Could be wrong though. Thanks, it is food for thought though.

On Mar 1, 10:01 am, Karl Swedberg <[EMAIL PROTECTED]> wrote:
> Not sure at all about this, but it kind of reminds me of Shaun Inman's
> Widon't script, that finds typographical widows and fixes them. I
> wonder if some set of regular expressions or string functions could
> get you what you want. I doubt it would be trivial, though. Anyway, if
> you're interested, here is a link:
>
> http://shauninman.com/archive/2007/01/03/widont_2_1_wordpress_plugin
>
> --Karl
> _
> Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> On Feb 29, 2008, at 11:29 PM, Klaus Hartl wrote:
>
>
>
> > PS: of course I may be wrong...
>
> > On Mar 1, 5:28 am, Klaus Hartl <[EMAIL PROTECTED]> wrote:
> >> Wasn't clear to me you were talking about solely jQuery, e.g.
> >> *JavaScript based* element selection.
>
> >> There are a few CSS selectors that are hardly - if at all  - to
> >> recreate with JavaScript. :first-line as well as :link and :visited
> >> belog to these...
>
> >> It may work somehow, but I doubt it would be in any way much
> >> reliable.
>
> >> --Klaus
>
> >> On Feb 29, 9:12 pm,bweaverusenet<[EMAIL PROTECTED]> wrote:
>
> >>> Klaus, thanks, but I'm talking about jquery selectors. (IE 6 doesn't
> >>> seem to support the next operator + in CSS, as in h2 + p:first-
> >>> line.)
> >>> Try the following in FF and IE. The :first-line alert gives an
> >>> error,
> >>> while :first works fine. Previous versions of jquery simply returned
> >>> nothing. So to sum-up:
>
> >>> * jquery doesn't seem to handle the :first-line selector
> >>> * IE6 doesn't support h2 + p:first-line in CSS
>
> >>> Thanks!
>
> >>> 
> >>> 
> >>> http://code.jquery.com/jquery-</a>
> >>> latest.pack.js">
> >>> 
> >>> #w{width:20em;}
> >>> h2 + p:first-line{color:red;}
> >>> 
> >>> 
> >>> $(document).ready(function(){
> >>> alert(":first=" + $("p:first").text());
> >>> alert(":first-line=" + $("p:first-line").text());//jquery error});
>
> >>> 
> >>> 
> >>> 
> >>> 
> >>> Test
> >>> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla
> >>> id
> >>> magna quis quam fermentum ultricies. Donec ac magna. Duis commodo
> >>> leo.
> >>> X.
> >>> Testing one two three.
> >>> 
> >>> 
> >>> 
>
> >>> On Feb 29, 2:45 pm, Klaus Hartl <[EMAIL PROTECTED]> wrote:
>
> >>>> On Feb 29, 6:53 pm,bweaverusenet<[EMAIL PROTECTED]> wrote:
>
> >>>>> Hi. Is there some workaround for the unsupported :first-line
> >>>>> pseudo-
> >>>>> selector to get the first line of text? Even if it involves
> >>>>> javascript
> >>>>> code. The only thing I can come up with is some overly-complex
> >>>>> typographical guesstimate of where the line ends, but that seems
> >>>>> fraught with problems. Any help would be appreciated. Thanks. -
> >>>>> bill
>
> >>>> The :first-line pseudo-element is supported since IE 5.5.
>
> >>>>http://msdn2.microsoft.com/en-us/library/ms530754(VS.85).aspx
>
> >>>> --Klaus


[jQuery] Re: :first-line workaround?

2008-03-03 Thread bweaverusenet

Thanks Klaus.

On Feb 29, 11:28 pm, Klaus Hartl <[EMAIL PROTECTED]> wrote:
> Wasn't clear to me you were talking about solely jQuery, e.g.
> *JavaScript based* element selection.
>
> There are a few CSS selectors that are hardly - if at all  - to
> recreate with JavaScript. :first-line as well as :link and :visited
> belog to these...
>
> It may work somehow, but I doubt it would be in any way much reliable.
>
> --Klaus
>
> On Feb 29, 9:12 pm,bweaverusenet<[EMAIL PROTECTED]> wrote:
>
> > Klaus, thanks, but I'm talking about jquery selectors. (IE 6 doesn't
> > seem to support the next operator + in CSS, as in h2 + p:first-line.)
> > Try the following in FF and IE. The :first-line alert gives an error,
> > while :first works fine. Previous versions of jquery simply returned
> > nothing. So to sum-up:
>
> > * jquery doesn't seem to handle the :first-line selector
> > * IE6 doesn't support h2 + p:first-line in CSS
>
> > Thanks!
>
> > 
> > 
> > http://code.jquery.com/jquery-</a>
> > latest.pack.js">
> > 
> > #w{width:20em;}
> > h2 + p:first-line{color:red;}
> > 
> > 
> > $(document).ready(function(){
> > alert(":first=" + $("p:first").text());
> > alert(":first-line=" + $("p:first-line").text());//jquery error});
>
> > 
> > 
> > 
> > 
> > Test
> > Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla id
> > magna quis quam fermentum ultricies. Donec ac magna. Duis commodo
> > leo.
> > X.
> > Testing one two three.
> > 
> > 
> > 
>
> > On Feb 29, 2:45 pm, Klaus Hartl <[EMAIL PROTECTED]> wrote:
>
> > > On Feb 29, 6:53 pm,bweaverusenet<[EMAIL PROTECTED]> wrote:
>
> > > > Hi. Is there some workaround for the unsupported :first-line pseudo-
> > > > selector to get the first line of text? Even if it involves javascript
> > > > code. The only thing I can come up with is some overly-complex
> > > > typographical guesstimate of where the line ends, but that seems
> > > > fraught with problems. Any help would be appreciated. Thanks. -bill
>
> > > The :first-line pseudo-element is supported since IE 5.5.
>
> > >http://msdn2.microsoft.com/en-us/library/ms530754(VS.85).aspx
>
> > > --Klaus


[jQuery] Re: Pretty XML?

2008-01-10 Thread bweaverusenet

Thanks, George. You know, anymore when I'm doing javascript I just
have jQuery on the brain, so naturally I posted what's mostly a
general javascript question to a jQuery group. Well, actually, I was
hoping to find some elegant jQuery voodoo or perhaps a plugin that
does this before reverting to something more rudimentary or rolling my
own. ;-)

Thanks again.

On Jan 10, 8:17 am, George <[EMAIL PROTECTED]> wrote:
> I'm not aware of any existing solution so I'd probably consider using
> regular expressions to add line feeds and tabs between elements. It
> will help alot if you can assume the xml will be well formed. Given
> the nature of this forum you might also consider a jQuery solution
> that iterates (recursively?) through the tree to copy element names
> and attributes as xml to a text string.
>
> George
>
> On Jan 9, 8:35 pm, bweaverusenet <[EMAIL PROTECTED]> wrote:
>
> > Any ideas? Thanks! -bill


[jQuery] Pretty XML?

2008-01-09 Thread bweaverusenet

Hi. Any thoughts on how to take an XML string, transform it into a
pretty HTML string, then insert it as an HTML element? Basically, I
want something that looks like the IE or FF XML display to be injected
into my HTML document.

Any ideas? Thanks! -bill


[jQuery] Re: Reload Page?

2007-09-27 Thread bweaverusenet

Your DOM updates won't be sticky, but "to reload the page" you can
window.location.reload().

Of course, you seem to be headed in a cleaner direction: just changing
the text elements in the DOM directly instead of reloading the page.

On Sep 27, 11:23 am, Danjojo <[EMAIL PROTECTED]> wrote:
> Is it possible to reload the page right after I set the cookie?
> Cause I have to update all of the text in a different language..
>
> // Flag image change on menu select, set the cookie with the spoken
> language choice
> // and reload the page in that language
>
> $("#languages").bind('change', function() {
> var country = $(this).val();
> if(country) {
> // This next line uses chainable methods starting at the
> second .attr
> $('#countryFlag').attr("src", "images/" + country +
> ".gif").attr("alt", country + " Flag");
> $.cookie('language', country, {expires: 7}); // set cookie
> }
>
> });
>
> A reload might be pointless though.. since I want to use Xpath plugin
> to replace all the text into another language, that can all take place
> on the page with the DOM replace?
>
> Thank you.



[jQuery] Re: Memory leak in 1.1.4?

2007-09-09 Thread bweaverusenet

Any official confirmation of the leak, or comments from the dev team?
Thanks! -bill

On Aug 28, 2:36 pm, CM-Z <[EMAIL PROTECTED]> wrote:
> In IE7 as well as in IE6 there is an memory leak.



[jQuery] Re: Memory leak in 1.1.4?

2007-08-28 Thread bweaverusenet

I can duplicate memory leakage in 1.1.4 with Firefox 2.0.0.6, but have
seen it in 1.1.3 and probably before. IE gobbles more memory but
eventually releases it. This could be a FF bug, but I haven't had the
chance to try duplicating with non-jquery javascript yet.

The following has a click that will slideToggle a div 1000 times on a
click. I lose about 10MB across the 1000 iterations. Seems to happen
for hide/show/toggle/etc.



http://code.jquery.com/jquery-
latest.pack.js">


Toggle
Lorem ipsum dolor sit.


$(document).ready(function(){
$("#clicktest").click( function(){
for(i=0;i<1000;i++)
$("#test").slideToggle(10,function()
{setTimeout(';',50)});
});

});





On Aug 28, 10:23 am, "John Resig" <[EMAIL PROTECTED]> wrote:
> In what browser are you seeing this?
>
> --John
>
> On 8/28/07, CM-Z <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello! I use utility Drip (http://www.outofhanwell.com/ieleak/
> > index.php?title=Main_Page) for the control of memory-leak.
> > The Drip shows memory-leak even in such simple case:
>
> > 
> > 
> > 
> > 
> > 
> > $(document).ready(function() {
> > $('.hover').click(
> > function() { $(this).text('clicked'); }
> > );
> > });
> > 
> > 
> > 
> > click me
> > 
> > 
>
> > It is a bug in Drip or in jQuery?
>
> > Sorry for my bad English.



[jQuery] Re: Help serializing form to array

2007-08-28 Thread bweaverusenet

That worked, thanks!

I'll check out the form plugin... just wanted to figure out what I was
doing wrong first. :-)


On Aug 28, 3:36 am, "Erik Beeson" <[EMAIL PROTECTED]> wrote:
> I think you could replace the parms = ... line with:
>
> parms[this.id] = this.value;
>
> But I suggest you check out the awesome form plugin:
>
> http://www.malsup.com/jquery/form/
>
> --Erik
>
> On 8/27/07, bweaverusenet <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi. What is the voodoo to build an array for a JSON submit from a
> > bunch of form fields?
>
> > Okay, I'm building the form dynamically from the fields in a mysql DB,
> > with input/@id set to the field name.
>
> > The following naive approach doesn't work, but will give you an idea
> > of how I'm grabbing what I want to do. It definitely doesn't like the
> > $.merge( parms, {this.id : this.value }) The error is "missing : after
> > property id"...
>
> >   $("form#additem").submit(function(){
> > var parms = { cmd:"ADD" };
> > $("form#additem//[EMAIL PROTECTED]").each(function(){
> > parms = $.merge( parms, {this.id : this.value } );
> > });
> > $.getJSON("thiscode.php",parms,function(data){});
> > return false;
> >   });
>
> > So, basically I am fishing for the best way to build or add to an
> > array from an arbitrary form and send into getJSON.
>
> > Thanks,
> > bill



[jQuery] Re: Help serializing form to array

2007-08-28 Thread bweaverusenet

Okay, thanks.

But I get the same error with $.extend( parms, {this.id :
this.value } );

   missing : after property id

Hmmm...

On Aug 28, 3:30 am, Wizzud <[EMAIL PROTECTED]> wrote:
> Use...
>
> $.extend( parms, {this.id : this.value } ); // extends parms with the
> subsequent objects
>
> The merge() method is for arrays, whereas parms and {this.id : this.value}
> are both objects, which is why you are getting the error.
>
>
>
> bweaverusenet wrote:
>
> > Hi. What is the voodoo to build an array for a JSON submit from a
> > bunch of form fields?
>
> > Okay, I'm building the form dynamically from the fields in a mysql DB,
> > with input/@id set to the field name.
>
> > The following naive approach doesn't work, but will give you an idea
> > of how I'm grabbing what I want to do. It definitely doesn't like the
> > $.merge( parms, {this.id : this.value }) The error is "missing : after
> > property id"...
>
> >   $("form#additem").submit(function(){
> >var parms = { cmd:"ADD" };
> >$("form#additem//[EMAIL PROTECTED]").each(function(){
> >parms = $.merge( parms, {this.id : this.value } );
> >});
> >$.getJSON("thiscode.php",parms,function(data){});
> > return false;
> >   });
>
> > So, basically I am fishing for the best way to build or add to an
> > array from an arbitrary form and send into getJSON.
>
> > Thanks,
> > bill
>
> --
> View this message in 
> context:http://www.nabble.com/Help-serializing-form-to-array-tf4339452s15494
> Sent from the JQuery mailing list archive at Nabble.com.



[jQuery] Help serializing form to array

2007-08-27 Thread bweaverusenet

Hi. What is the voodoo to build an array for a JSON submit from a
bunch of form fields?

Okay, I'm building the form dynamically from the fields in a mysql DB,
with input/@id set to the field name.

The following naive approach doesn't work, but will give you an idea
of how I'm grabbing what I want to do. It definitely doesn't like the
$.merge( parms, {this.id : this.value }) The error is "missing : after
property id"...

  $("form#additem").submit(function(){
var parms = { cmd:"ADD" };
$("form#additem//[EMAIL PROTECTED]").each(function(){
parms = $.merge( parms, {this.id : this.value } );
});
$.getJSON("thiscode.php",parms,function(data){});
return false;
  });

So, basically I am fishing for the best way to build or add to an
array from an arbitrary form and send into getJSON.

Thanks,
bill