Code Monkey home page Code Monkey logo

Comments (27)

dwa012 avatar dwa012 commented on June 25, 2024

I am not really sure what the problem is. The Polymer code seems to work on other sites. There is some issue where wither the framework or Rails gets confused and cannot seem to execute the polymer templates properly.

from emcee.

ahuth avatar ahuth commented on June 25, 2024

Thanks for bringing up the issue! I have used Polymer, Rails, and Emcee together successfully. I have had several issues come up specifically with core-icons, though.

I'll see if I can figure out what the problem is.

from emcee.

dwa012 avatar dwa012 commented on June 25, 2024

@ahuth I thought is was the Polymer code at first, but it seems to work on other sites. It is a really strange issue.

from emcee.

rastyagaev avatar rastyagaev commented on June 25, 2024

Hi. I had simmilar issue yesterday and the problem comes with nokogiri's html escaping. It escapes some attributes, src for example, and ruins '{{' and '}}' symbols. I can't find nokigiri's option which can turn off the escaping and I think the better way is unescaping the symbols back in 'process' method of each processors.

from emcee.

dwa012 avatar dwa012 commented on June 25, 2024

@rastyagaev I am unfamiliar with nokogiri's purpose is. It seems to be dependent gem in Rails though. Does the gem provide a way to provide how to escape or exclude some character sets/

from emcee.

dwa012 avatar dwa012 commented on June 25, 2024

If you open paper-button and change the following

 <core-icon id="icon" src="{{iconSrc}}" icon="{{icon}}"></core-icon>

to

 <core-icon id="icon" src="temp" icon="{{icon}}"></core-icon>

(I am calling the element with only the icon attribute set)
you can see it trying to grab the "temp" resource.

I think @rastyagaev is on the right track. The {{iconSrc}} being escaped to %7B%7BiconSrc%7D%7D is most likely the problem.

I am just not sure how to attempt to fix the issue.

from emcee.

rastyagaev avatar rastyagaev commented on June 25, 2024

Try also this: <core-icon id="icon" data-src="{{iconSrc}}" icon="{{icon}}"></core-icon>.

Does the gem provide a way to provide how to escape or exclude some character sets?

No, it doesn't (as far as I can see). Nokogiri's doc also has the to_xml method which doesn't escape symbols, but inserts CDATA around js-code. Insertion occurs each time when you run to_xml in sprokets processors and code looks like this:

<script><![CDATA[<![CDATA[<![CDATA[
  Polymer('test-element')
]]]]]]><![CDATA[><![CDATA[>]]]]><![CDATA[>]]></script>

from emcee.

rastyagaev avatar rastyagaev commented on June 25, 2024

You can use version 0.2. It works for me.

from emcee.

dwa012 avatar dwa012 commented on June 25, 2024

@rastyagaev yeah, not sure where we can go from here. Can we just ignore the sprocket parsing and do it directly in the head for the layout?

version 0.2 of Polymer? I was hoping to use some of the new items in the 0.3.3 for a project.

from emcee.

rastyagaev avatar rastyagaev commented on June 25, 2024

No. Version 0.2.0 of Emcee.

from emcee.

dwa012 avatar dwa012 commented on June 25, 2024

Downgraded to 0.2.0 and still have the same error .....
I thought it was working, but still giving me the same trouble.

from emcee.

rastyagaev avatar rastyagaev commented on June 25, 2024

Have you cleaned the rails cache after downgrading?

from emcee.

dwa012 avatar dwa012 commented on June 25, 2024

@rastyagaev I just cleared the cache.

Can you link to code that you have it working with?
I am running into a new error, and could use an example with Polymer.

from emcee.

rastyagaev avatar rastyagaev commented on June 25, 2024

Sure. https://gist.github.com/rastyagaev/47387ec1664d8dd2e2be

from emcee.

ahuth avatar ahuth commented on June 25, 2024

Thanks for the info, guys. I've got a fix-character-escaping branch and added a test for this. If you guys get a chance, can you test this branch out and see if it fixes your issues?

If not, I'll merge it in and go from there.

Right now the fix just substitutes the correct characters back in - for instance, %7B gets replaced by {. Pretty low-tech, and I'd like to find something better, but it works.

from emcee.

rastyagaev avatar rastyagaev commented on June 25, 2024

Yes, it works. Thanks for fix!

from emcee.

ahuth avatar ahuth commented on June 25, 2024

No problem. The change has been merged into master, but it's not in a release, yet.

Also, I've changed the fix to use URI.unescape instead of my own custom method. You can see this here. My tests still pass with this, but I don't think I've tested every possible case.

from emcee.

ahuth avatar ahuth commented on June 25, 2024

This fix has now made it to release 1.0.2, and it is on rubygems.org.

from emcee.

dwa012 avatar dwa012 commented on June 25, 2024

@ahuth thanks for the work. That seems to have fixed that issue. I am trying to figure out an issue in the paper-shadow component. Some strange JS error. I think it is unrelated to what we were doing here.

from emcee.

ahuth avatar ahuth commented on June 25, 2024

@dwa012 Out of curiosity, can you tell me what the JS error is? It's not for an illegal token or for polymer.js not being loaded, is it?

from emcee.

dwa012 avatar dwa012 commented on June 25, 2024

@ahuth The issue is in paper-shadow/paper-shadow.html line 112.

In this block

      registerCallback: function(polymerElement) {
        var template = polymerElement.querySelector('template');
        this._style = template.content.querySelector('style');
        this._style.removeAttribute('no-shim');
      }

specifically

this._style.removeAttribute('no-shim');

this._style is null after trying to query the style selector.

I put a guard around it for now, but that causes some rendering issues for the paper-buttons.
I am not sure if it is an import problem or not.

from emcee.

ahuth avatar ahuth commented on June 25, 2024

Ok, I'll take a look at it. I haven't used 'paper' elements before, but I definitely want to make sure this isn't an issue with Emcee.

Thanks.

from emcee.

davidhq avatar davidhq commented on June 25, 2024

Is this solved for good? Because even on emcee (1.0.7) I have problems with icons...

<core-icon src="%7B%7Bsrc%7D%7D" icon="{{icon}}"></core-icon><content></content>

from emcee.

ahuth avatar ahuth commented on June 25, 2024

This was solved for good, although it's become an issue with recent changes. See issues #28 and #29.

My unit tests all still pass, so not sure why this isn't working anymore, but I'll look into it this weekend.

from emcee.

ahuth avatar ahuth commented on June 25, 2024

In the meantime, v1.0.6 should work.

from emcee.

davidhq avatar davidhq commented on June 25, 2024

It does (I had to delete cache as well)... so thank you...

from emcee.

ahuth avatar ahuth commented on June 25, 2024

Solved with v1.0.8.

from emcee.

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.