Giter Site home page Giter Site logo

Comments (5)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024
Personally i dont think setting null and preserving chain is correct behaviuor. 
Such
thing should be done thought removeAttr($name) or at least attr($name, "").

Thats simply because there is no (straightforward) way to determine what do you
expect when second param is null (it should be by default something which 
simulates
null, but its not null).

But i can be wrong, does jQuery allows that ?

Original comment by [email protected] on 2 Oct 2008 at 9:00

from phpquery.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024
I think jQuery allows chaining in such a case. It does not chain on the 
attribute 
but on the element from which the attribut has been deleted / remove or in this 
case 
set to null.

But there is no setting to null with jQuery. Just an Idea: Maybe setting an 
attribute value to null should throw an exception for the sake of clarify.

Original comment by [email protected] on 5 Oct 2008 at 10:04

from phpquery.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024
Test case :
<js>$('div#contenu_actualite').attr('id',null).find('div.bloc_arrondi_haut').att
r('class');</js>
display : "bloc_arrondi_haut" so chaining works

<js>$('div#contenu_actualite').attr('id',undefined).find('div.bloc_arrondi_haut'
).attr('class');</js>
get an error, so chaining doesn't work

Original comment by [email protected] on 6 Oct 2008 at 10:23

from phpquery.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024
A little "hack" to get chaining work with null value is :
<php>
$myValue = null;

echo $myPhpQuery->find('#myId)->attr('myAttr',''.$myValue)->end()->html();
</php>

And it's working ;).

Original comment by [email protected] on 13 Oct 2008 at 1:58

from phpquery.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024
As PHP doesnt support 'undefined' type, 'null' is used as equivalent.
In jQuery following code:
.attr('id',null)
will result in id='null'
In phpQuery it can be easly achived by:
->attr('id', 'null')
with same result.

Original comment by [email protected] on 18 Oct 2008 at 9:00

  • Changed state: WontFix
  • Added labels: Component-phpQuery

from phpquery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.