საიტის გასაუმჯობესებელი სამუშაოების მიმდინარეობისას, შესაძლებლობების ნაწილი შეიზღუდება. თუ სტატიით ვერ მოახერხებ ხარვეზის გამოსწორება და შეკითხვის დასმა გსურთ, ჩვენი მხარდაჭერის გუნდი დაგეხმარებათ @FirefoxSupport გვერდის მეშვეობით Twitter-ზე და /r/firefox განყოფილებაში Reddit-ზე.

ძიება მხარდაჭერაში

ნუ გაებმებით თაღლითების მახეში მხარდაჭერის საიტზე. აქ არასდროს მოგთხოვენ სატელეფონო ნომერზე დარეკვას, შეტყობინების გამოგზავნას ან პირადი მონაცემების გაზიარებას. გთხოვთ, გვაცნობოთ რამე საეჭვოს შემჩნევისას „დარღვევაზე მოხსენების“ მეშვეობით.

ვრცლად

Javascript command window.getComputedStyle(document.body, ':after').getPropertyValue('content') returns content with extra double quotes

  • 1 პასუხი
  • 2 მომხმარებელი წააწყდა მსგავს სიძნელეს
  • 6 ნახვა
  • ბოლოს გამოეხმაურა cor-el

When I use in my css: body:after { content: "mobile"; display: none; } And check this with javascript with the command: var size = window.getComputedStyle(document.body, ':after').getPropertyValue('content');

I get in firefox (v 23.0.1 mac) returned the string ""mobile"" with doubled quotes as return and therefore the check if size =="mobile" returns false. In safari the value returned "mobile" without the doubles quotes. How come?

When I use in my css: body:after { content: "mobile"; display: none; } And check this with javascript with the command: var size = window.getComputedStyle(document.body, ':after').getPropertyValue('content'); I get in firefox (v 23.0.1 mac) returned the string ""mobile"" with doubled quotes as return and therefore the check if size =="mobile" returns false. In safari the value returned "mobile" without the doubles quotes. How come?

გადაწყვეტა შერჩეულია

What you get is a string that represents of what you specified in content.

A content specification can include other things like a counter: body:after { content: "topics[" counter(topics) "]"; }

size = window.getComputedStyle(document.body, ':after').content would give: "topics[" counter(topics) "]"
So you need to test for the exact text of the content: size=='"mobile"';

პასუხის ნახვა სრულად 👍 0

ყველა პასუხი (1)

შერჩეული გადაწყვეტა

What you get is a string that represents of what you specified in content.

A content specification can include other things like a counter: body:after { content: "topics[" counter(topics) "]"; }

size = window.getComputedStyle(document.body, ':after').content would give: "topics[" counter(topics) "]"
So you need to test for the exact text of the content: size=='"mobile"';