DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Find Corresponding Template from a Page Element in a Meteor Powered Website


Open "newfairs.com" in Firefox. Right click of a page element and choose "inspect element", for example, here is <p class="one-line">. Right click it and choose "New Attribute", add id="mytarget".

In console, input Blaze.getView(document.getElementById('mytarget')) and press Enter. You get

Object { name="Template.productListItem",  _callbacks={...},  isCreated=true,  more...}

Now you know this element is defined in template "productListItem".

Because ag can't search text in git submodule with ag Template.productListItem directly, search 'Template.productListItem' in all packages with

git --no-pager submodule foreach --recursive 'ag Template.productListItem'

Discussion

Where does Blaze come from? When connected with the web server, the browser receives many JavaScript files. All html code is generated dynamically from these js files. And Blaze is defined and loaded in these files, too.



Published

Mar 1, 2016

Last Updated

Mar 1, 2016

Category

Tech

Tags

  • meteor 47
  • template 4
  • view 1

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor