Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

166
Views
¿Es posible utilizar módulos ECMAScript (ESM) en documentos SVG?

¿O será compatible con futuras versiones de navegadores? Estuve pensando en esto y traté de leer sobre el tema, pero no pude resolverlo. También probé lo siguiente (que no funcionó ni en Chrome 96 ni en Safari 14):

 <?xml version="1.0" encoding="utf-8"?> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" xml:space="preserve"> <script type="module"> import { demo } from './demo.js' const test = new demo(); console.log('x', test); </script> <rect x="0" y="0" width="50" height="50" /> </svg>

¿Es posible? ¿Será posible? ¿Hay una solución?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Ejemplo muy básico

 customElements.define("svg-component", class extends HTMLElement{ connectedCallback(){ this.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" xml:space="preserve"> <rect x="0" y="0" width="50" height="50" fill="${this.getAttribute('fill')}" /> </svg>`; // Your JS here } });
 svg-component{ width:150px; display:inline-block; }
 <svg-component fill="red"></svg-component> <svg-component fill="yellow"></svg-component> <svg-component fill="blue"></svg-component>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!