question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HTML <object> tag completely recreates the vue app i a new inline element

See original GitHub issue

Version

3.8.0

Reproduction link

https://github.com/calexandru2018/vuejs-SPA

Environment info

Environment Info:

  System:
    OS: Linux 4.19 Manjaro Linux undefined
    CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
  Binaries:
    Node: 12.9.1 - /usr/bin/node
    Yarn: Not Found
    npm: 6.11.3 - /usr/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: 69.0.1
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0 
    @vue/babel-plugin-transform-vue-jsx:  1.0.0 
    @vue/babel-preset-app:  3.8.0 
    @vue/babel-preset-jsx:  1.0.0 
    @vue/babel-sugar-functional-vue:  1.0.0 
    @vue/babel-sugar-inject-h:  1.0.0 
    @vue/babel-sugar-v-model:  1.0.0 
    @vue/babel-sugar-v-on:  1.0.0 
    @vue/cli-overlay:  3.8.0 
    @vue/cli-plugin-babel: ^3.8.0 => 3.8.0 
    @vue/cli-plugin-eslint: ^3.8.0 => 3.8.0 
    @vue/cli-plugin-pwa: ^3.8.0 => 3.8.0 
    @vue/cli-service: ^3.8.0 => 3.8.4 
    @vue/cli-shared-utils:  3.8.0 
    @vue/component-compiler-utils:  2.6.0 
    @vue/eslint-config-standard: ^4.0.0 => 4.0.0 
    @vue/preload-webpack-plugin:  1.1.0 
    @vue/web-component-wrapper:  1.2.0 
    eslint-plugin-vue: ^5.0.0 => 5.2.2 (4.7.1)
    vue: ^2.6.10 => 2.6.10 
    vue-cli-plugin-vuetify: ^0.5.0 => 0.5.0 
    vue-eslint-parser:  2.0.3 (5.0.0)
    vue-hot-reload-api:  2.3.3 
    vue-loader:  15.7.0 
    vue-router: ^3.0.3 => 3.0.6 
    vue-style-loader:  4.1.2 
    vue-template-compiler: ^2.6.10 => 2.6.10 
    vue-template-es2015-compiler:  1.9.1 
    vue2-touch-events: ^2.0.0 => 2.0.0 
    vuetify: ^1.5.16 => 1.5.16 
    vuex: ^3.0.1 => 3.1.1 
  npmGlobalPackages:
    @vue/cli: 3.11.0

Steps to reproduce

  1. Create a Vue-Cli project with the default setup 3.Add a image(svg) at your choice in the “assets” folder 4.Create at the least one additional component that is not rendered/displayed on main page upon running “npm run serve” (with a v-if and a control variable) 5.Insert the following code inside the newly created component: “<“object type=“image/svg xml” data=”…/assets/[filename].svg”></object">" (remove the extra ") 6.Call the component

What is expected?

It is expected that a object with the svg appears.

What is actually happening?

The whole Vue app is re-rendered inside itself, a sorts of inception.


Tested on three different projects, same result on all of them. I wanted to create an inline svg object so that it could be manipulated.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
LinusBorgcommented, Oct 1, 2019

Can’t run it right now, but that’s likely because

  1. the path in the data attribute is not resolved by vue-loader(by default, only works for src on img etc.)
  2. so it stays like it is - and `localhot:8080/…/assets/…`` isn’t a valid path
  3. so the dev server re-routes the request to index.html
  4. which gets rendered inside the <object>

Solution:

<"object type="image/svg xml" :data="require(../assets/[filename].svg)"></object">
0reactions
calexandru2018commented, Oct 13, 2019

Sorry for late response, I managed to test it a bit deeper and have fixed per your recommendation in

Type should be image/svg+xml

Thank you for the tip Linus, I am closing the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Use Inline-level and Block-level Elements in HTML
This tutorial will teach you the difference between inline-level and block-level elements in HTML and how they affect a piece of content's ...
Read more >
Objects, Images, and Applets in HTML documents
The new OBJECT element thus subsumes some of the tasks carried out by ... The IMG element has no content; it is usually...
Read more >
Using SVG and Vue.js: A complete guide - LogRocket Blog
This is a complete guide to using SVG with Vue, including practical examples and best practices to help you along the way.
Read more >
Dynamically Switching From One HTML Element to Another in ...
A friend once contacted me asking if I had a way to dynamically change one HTML element into another within Vue's template block....
Read more >
Dynamic & Async Components - Vue.js
That's because each time you switch to a new tab, Vue creates a new instance of the currentTabComponent . Recreating dynamic components is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found