-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: The URL involved in the dynamic modification element inline style is not converted to an absolute path #768
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -490,12 +490,18 @@ export default class MutationBuffer { | |
} | ||
const styleObj = item.attributes.style as styleAttributeValue; | ||
for (const pname of Array.from(target.style)) { | ||
const newValue = target.style.getPropertyValue(pname); | ||
let newValue = target.style.getPropertyValue(pname); | ||
const newPriority = target.style.getPropertyPriority(pname); | ||
if ( | ||
newValue !== old.style.getPropertyValue(pname) || | ||
newPriority !== old.style.getPropertyPriority(pname) | ||
) { | ||
newValue = transformAttribute( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (would need to import attributeToStylesheet and also maybe change it's href attribute to default to getHref() rather than importing getHref also) |
||
this.doc, | ||
(m.target as HTMLElement).tagName, | ||
m.attributeName, | ||
newValue, | ||
); | ||
if (newPriority === '') { | ||
styleObj[pname] = newValue; | ||
} else { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html lang='en'> | ||
<head> | ||
<meta charset='UTF-8'> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | ||
<title>absolute image url</title> | ||
<script src="../../../rrweb-snapshot/dist/rrweb-snapshot.js"></script> | ||
</head> | ||
<body> | ||
<div id='div1' style='height: 200px; background-image: url("static.png")'></div> | ||
<div id='div2' style='height: 200px;'></div> | ||
<button onclick='addDynamicBackgroundImage()'>add dynamic background image</button> | ||
<script> | ||
function addDynamicBackgroundImage() { | ||
document.querySelector('#div2').style.setProperty('background-image', 'url(dynamic.png)') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The images are cute! However they do need to be downloaded by everyone who downloads rrweb ... so they can be removed without affecting the test case (it shouldn't matter for the purposes of the test whether they actually exist) |
||
} | ||
</script> | ||
</body> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought we might need to do the transformation here, but you are right to wait til after the comparison.