Execute code on the native javascript, without the use of jQuery?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Execute code on the native javascript, without the use of jQuery?

Genosse
Hello!
For example, I want to work with the SVG. 
But jQuery make auto lower casing attribute values... for example: baseProfile -> baseprofile.., and so on... 

I am writing in terms of javascript: 
<var testTest=document.getElementsByTagName('svg')[0].setAttribute('baseProfile', 'full')>

 But the result is still in lowercase...

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute code on the native javascript, without the use of jQuery?

Herby Vojčík
I'd suspect it is not thing of jQuery, but of HTML itself. I am lazy to look for reference, but I'd assume attribute names are case-insensitive, and it may be your browser which is lowercasing them. Normally, for multiword attribute names, dash-casing is used, like user-profile.

Александр Р wrote:

> Hello!
> For example, I want to work with the SVG.
> But jQuery make auto lower casing attribute values... for example:
> base*P*rofile -> base*p*rofile.., and so on...
>
> I am writing in terms of javascript:
> /<var
> testTest=document.getElementsByTagName('svg')[0].setAttribute('baseProfile',
> 'full')>/
>
> But the result is still in lowercase...
>
> --
> You received this message because you are subscribed to the Google
> Groups "amber-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [hidden email]
> <mailto:[hidden email]>.
> For more options, visit https://
groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute code on the native javascript, without the use of jQuery?

Genosse
SVG & XML - case sensitive.
jQuery - changes the case of the characters is forced, but the developers are in no hurry to fix this bug ... (http://bugs.jquery.com/ticket/11166#propertyform)
in the   Seaside code native javascript worked correctly, but in the Amber does not work....

пятница, 1 августа 2014 г., 15:08:56 UTC+4 пользователь Herby написал:
I'd suspect it is not thing of jQuery, but of HTML itself. I am lazy to look for reference, but I'd assume attribute names are case-insensitive, and it may be your browser which is lowercasing them. Normally, for multiword attribute names, dash-casing is used, like user-profile.


--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute code on the native javascript, without the use of jQuery?

Herby Vojčík


Александр Р wrote:
> SVG & XML - case sensitive.
> jQuery - changes the case of the characters is forced, but the
> developers are in no hurry to fix this bug ...
> (http://bugs.jquery.com/ticket/11166#propertyform)

Good to know.

> /in the Seaside code native javascript worked correctly, but in the
> Amber does not work..../

This is strange, I would even firmly say it's not true. Once you do native JavaScript method (<> delimited) in Amber, it is copied verbatim, so Amber has no workings in this. It is the same as if you run the code directly from JS or from console.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute code on the native javascript, without the use of jQuery?

Genosse
I do not know what to answer .... 

I have this code:
setAttribute
<var testTest=document.getElementsByTagName('svg')[0].setAttribute('baseProfile', 'full')>
 
designated event onClick: [self setAttribute];

result - baseprofile="full"


I'll find ways around .....

пятница, 1 августа 2014 г., 15:25:36 UTC+4 пользователь Herby написал:
Once you do native JavaScript method (<> delimited) in Amber, it is copied verbatim, so Amber has no workings in this. It is the same as if you run the code directly from JS or from console.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute code on the native javascript, without the use of jQuery?

Genosse
In reply to this post by Herby Vojčík
Realization of Widget renderOn: jQuery uses?

пятница, 1 августа 2014 г., 15:25:36 UTC+4 пользователь Herby написал:
It is the same as if you run the code directly from JS or from console.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute code on the native javascript, without the use of jQuery?

Herby Vojčík


Александр Р wrote:
> Realization of /Widget renderOn:/ jQuery uses?

???
Sorry, what has this to do with Widget using jQuery? You were claiming that JS code does not work in Amber as is, I told you it does. Any native JS method run _exactly_ same code you put into it. You complained with example of method using direct DOM that it does not work, because attribute is lowercase. It works. It runs directly that same code you put into it.
Again, what does have this in common with Widget using jQuery?

> пятница, 1 августа 2014 г., 15:25:36 UTC+4 пользователь Herby написал:
>
>     It is the same as if you run the code directly from JS or from
>     console.
>
> --
> You received this message because you are subscribed to the Google
> Groups "amber-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [hidden email]
> <mailto:[hidden email]
om>.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute code on the native javascript, without the use of jQuery?

Genosse
Well....
 for example: 
-------------------------
<body>
    <svg id="svg" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink" height="200" width="300">
          <rect height="100" width="150" style="fill:#1a1a1a;fill-rule:evenodd;stroke:#ff0000;stroke-width:5;"></rect>
    </svg>
    <script>
          window.onload = function() {
               var testTest=document.getElementsByTagName('svg')[0].setAttribute('baseProfile', 'full')
          }

   </script>
</body>
--------------------------------
It works correctly......

In Amber incorrectly.... :((
Somewhere there is conversion to lowercase.......

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute code on the native javascript, without the use of jQuery?

Herby Vojčík


Александр Р wrote:

> Well....
> for example:
> -------------------------
> <body>
> <svg id="svg" version="1.1" xmlns="http://www.w3.org/2000/svg"
> xmlns:ev="http://www.w3.org/2001/xml-events"
> xmlns:xlink="http://www.w3.org/1999/xlink" height="200" width="300">
> <rect height="100" width="150"
> style="fill:#1a1a1a;fill-rule:evenodd;stroke:#ff0000;stroke-width:5;"></rect>
> </svg>
> <script>
> window.onload = function() {
> var
> testTest=document.getElementsByTagName('svg')[0].setAttribute('baseProfile',
> 'full')
> }
>
> </script>
> </body>
> --------------------------------
> It works correctly......
>
> In Amber incorrectly.... :((

Prove.

Citing your OP:
I am writing in terms of javascript:
----
<var
testTest=document.getElementsByTagName('svg')[0].setAttribute('baseProfile',
'full')>

  But the result is still in lowercase...
----
This is simply not true. If you use nativeJS method, if does exactly
what is written.

If you do some manipulation with Web package, which uses jQuery, then
yes, it can lowercase it somewhere on the way. But the aforemenetioned
code works _correctly_ in Amber.

So what do you mean by "In Amber incorrectly"?

> Somewhere there is conversion to lowercase.......

P.S.: By 'prove' I mean 'write a SUnit test which shows the failure when
run by SUnit runner in browser'.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute code on the native javascript, without the use of jQuery?

Genosse
Well, I do not know how to write a test using the browser in the test ... 
The compiled code javascript it's ok. But with Amber on the fly is converted to lowercase. 

If you are interested can take a look https://github.com/Alexander-Remizov/SVG-Amber-Tools (it's not bower_components)

пятница, 1 августа 2014 г., 16:35:42 UTC+4 пользователь Herby написал:

P.S.: By 'prove' I mean 'write a SUnit test which shows the failure when
run by SUnit runner in browser'.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute code on the native javascript, without the use of jQuery?

Genosse
In reply to this post by Herby Vojčík

пятница, 1 августа 2014 г., 16:35:42 UTC+4 пользователь Herby написал:
If you do some manipulation with Web package, which uses jQuery, then
yes, it can lowercase it somewhere on the way. 

Yes, I think that the blame for the jQuery (http://bugs.jquery.com/ticket/11166#propertyform). But I do not use the jQuery separately from the Amber. Thus it turns out that the Amber uses the  jQuery....  

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute code on the native javascript, without the use of jQuery?

Herby Vojčík


Александр Р wrote:

>
> пятница, 1 августа 2014 г., 16:35:42 UTC+4 пользователь Herby написал:
>
>     If you do some manipulation with Web package, which uses jQuery, then
>     yes, it can lowercase it somewhere on the way.
>
>
> Yes, I think that the blame for the jQuery
> (http://bugs.jquery.com/ticket/11166#propertyform). But I do not use
> the jQuery separately from the Amber. Thus it turns out that the Amber
> uses the jQuery....

Of course, everything in Amber Web package is heavy jQuery.

I objected only to your claim the even nativeJS somehow magically does not work and lowercases attributes, which is of course not true. But whenever you use Web package (HTMLCanvas & Co.) everything goes through jQuery. #with: and #contents: of course as well. If you want to eschew jQuery, you must stop using Amber's HTMLCanvas-based access to page and its elements and do everything yourself (possibly use different library, no need to
do eveything in low-level DOM).

Or, submit a patch to jQuery. ;-)

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute code on the native javascript, without the use of jQuery?

Genosse
I get it. I thought so. I wanted to ask whether there is a workaround in the Amber ... 
So there is no workaround. I'll think more ...;)

пятница, 1 августа 2014 г., 17:44:10 UTC+4 пользователь Herby написал:


Александр Р wrote:

>
> пятница, 1 августа 2014 г., 16:35:42 UTC+4 пользователь Herby написал:
>
>     If you do some manipulation with Web package, which uses jQuery, then
>     yes, it can lowercase it somewhere on the way.
>
>
> Yes, I think that the blame for the jQuery
> (<a href="http://bugs.jquery.com/ticket/11166#propertyform" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fbugs.jquery.com%2Fticket%2F11166%23propertyform\46sa\75D\46sntz\0751\46usg\75AFQjCNGkEu2CCg1_QxMsVFbourDfoalOJQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fbugs.jquery.com%2Fticket%2F11166%23propertyform\46sa\75D\46sntz\0751\46usg\75AFQjCNGkEu2CCg1_QxMsVFbourDfoalOJQ';return true;">http://bugs.jquery.com/ticket/11166#propertyform). But I do not use
> the jQuery separately from the Amber. Thus it turns out that the Amber
> uses the jQuery....

Of course, everything in Amber Web package is heavy jQuery.

I objected only to your claim the even nativeJS somehow magically does not work and lowercases attributes, which is of course not true. But whenever you use Web package (HTMLCanvas & Co.) everything goes through jQuery. #with: and #contents: of course as well. If you want to eschew jQuery, you must stop using Amber's HTMLCanvas-based access to page and its elements and do everything yourself (possibly use different library, no need to
do eveything in low-level DOM).

Or, submit a patch to jQuery. ;-)

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute code on the native javascript, without the use of jQuery?

Herby Vojčík
You may try to investigate some alternative ways... maybe stopping using with: and contents: and instead using (ugly) html / html: to read/write SVG parts of the page could be enough...

Herby

Александр Р wrote:

> I get it. I thought so. I wanted to ask whether there is a workaround
> in the Amber ...
> So there is no workaround. I'll think more ...;)
>
> пятница, 1 августа 2014 г., 17:44:10 UTC+4 пользователь Herby написал:
>
>
>
>     Александр Р wrote:
>     >
>     > пятница, 1 августа 2014 г., 16:35:42 UTC+4 пользователь Herby
>     написал:
>     >
>     > If you do some manipulation with Web package, which uses jQuery,
>     then
>     > yes, it can lowercase it somewhere on the way.
>     >
>     >
>     > Yes, I think that the blame for the jQuery
>     > (http://bugs.jquery.com/ticket/11166#propertyform
>     <http://bugs.jquery.com/ticket/11166#propertyform>). But I do not use

>     > the jQuery separately from the Amber. Thus it turns out that the
>     Amber
>     > uses the jQuery....
>
>     Of course, everything in Amber Web package is heavy jQuery.
>
>     I objected only to your claim the even nativeJS somehow magically
>     does not work and lowercases attributes, which is of course not
>     true. But whenever you use Web package (HTMLCanvas & Co.)
>     everything goes through jQuery. #with: and #contents: of course as
>     well. If you want to eschew jQuery, you must stop using Amber's
>     HTMLCanvas-based access to page and its elements and do everything
>     yourself (possibly use different library, no need to
>     do eveything in low-level DOM).
>
>     Or, submit a patch to jQuery. ;-)
>
> --
> You received this message because you are subscribed to the Google
> Groups "amber-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [hidden email]
> <mailto
:[hidden email]>.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute code on the native javascript, without the use of jQuery?

Genosse
I did an experiment. Edited all the toLowerCase () in the code of jQuery.
In a typical test (html) directive   $("svg").attr({ baseProfile: "full" }); now works correctly. But the Amber is still lower case...

???

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute code on the native javascript, without the use of jQuery?

Genosse
In reply to this post by Herby Vojčík
Problem been solved registerdepended attributes. :)
Thanks to Nikolay Kleptsov.
Details are here https://github.com/Alexander-Remizov/SVG-Amber-Tools.

PS. Necessarily the case <html xmlns="http://www.w3.org/1999/xhtml">.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute code on the native javascript, without the use of jQuery?

Herby Vojčík
In reply to this post by Genosse
So who was the culprit, browser/DOM or jQuery?

Can you send exact call fixing the case for baseProfile for reference?

Herby

Александр Р <[hidden email]>napísal/a:

Problem been solved registerdepended attributes. :)
Thanks to Nikolay Kleptsov.
Details are here https://github.com/Alexander-Remizov/SVG-Amber-Tools.

PS. Necessarily the case <html xmlns="http://www.w3.org/1999/xhtml">.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute code on the native javascript, without the use of jQuery?

Genosse
jQuery toLowerCase() 100%.
---
// All attributes are lowercase // Grab necessary hook if one is defined if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { name = name.toLowerCase(); hooks = jQuery.attrHooks[ name ] || ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); }
---
And in 42 locations.

But you can use the native javascript.
But for some reason, javascript of this type (.setAttribute()) to Amber projects also gives lower case...

Works correctly javascript of this type (.setAttributeNS()).

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute code on the native javascript, without the use of jQuery?

Herby Vojčík
You did not include the fixing code, and you again repeat that (not true IMNSHO) claim that plain javascript call does not work in Amber, without showing clearly by a unit test. :-/ I personally stop being interested in this issue, but good for you that you fixed what you wanted to.

Александр Р wrote:

> jQuery toLowerCase() 100%.
> ---
> // All attributes are lowercase
> // Grab necessary hook if one is defined
> if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
> name = name.toLowerCase();
> hooks = jQuery.attrHooks[ name ] ||
> ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
> }
>
> ---
> And  in 42  locations.
>
> But you can use the native javascript.
> But for some reason, javascript of this type (.setAttribute()) to Amber projects also gives lower case...
>
> Works correctly javascript of this type (.setAttributeNS()).
>
> --
> You received this message because you are subscribed to the Google
> Groups "amber-lang" group.
> To un
subscribe from this group and stop receiving emails from it, send
> an email to [hidden email]
> <mailto:[hidden email]>.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Execute code on the native javascript, without the use of jQuery?

Genosse
I do not know the reason
I ascertain  the experimental fact [.setAttribute() -> lower case in Amber].
I think that the problem is not in the code of Amber, and the specifics of the interaction of the browser & js & DOM  (dynamic addition).
But I can not say sure..... ;)

воскресенье, 10 августа 2014 г., 0:47:45 UTC+4 пользователь Herby написал:
You did not include the fixing code, and you again repeat that (not true IMNSHO) claim that plain javascript call does not work in Amber, without showing clearly by a unit test. :-/ I personally stop being interested in this issue, but good for you that you fixed what you wanted to.

Александр Р wrote:

> jQuery toLowerCase() 100%.
> ---
> // All attributes are lowercase
> // Grab necessary hook if one is defined
>                 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
>                         name = name.toLowerCase();
>                         hooks = jQuery.attrHooks[ name ] ||
>                                 ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
>                 }
>
> ---
> And  in 42  locations.
>
> But you can use the native javascript.
> But for some reason, javascript of this type (.setAttribute()) to Amber projects also gives lower case...
>
> Works correctly javascript of this type (.setAttributeNS()).
>
> --
> You received this message because you are subscribed to the Google
> Groups "amber-lang" group.
> To un
subscribe from this group and stop receiving emails from it, send
> an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="p7CK_POjvHAJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">amber-lang+...@googlegroups.com
> <mailto:<a href="javascript:" target="_blank" gdf-obfuscated-mailto="p7CK_POjvHAJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">amber-lang+unsubscribe@...>.
> For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
12